javascript - error while creating dynamic button and how to add click event dynamically without using id -


var shoplink=  $("<button></button>")                .prop("id",i)                .val("view more")                .css({                      width: '20px'                      height: '20px'                }); 

when used button js file not working.i want add click events button dynamically without using id.

css function params worng, missed , , button have value attr form data should use text() function instead of val()

.css({  width: '20px' , height: '20px' /\ });             |----------------   

try

 var shoplink=$("<button></button>")     .prop("id","idbutton")     .text("view more")     .css({      width: '20px',     height: '20px'     }); 

demo


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -