javascript - jQuery .on("click") - alternative to .live() -


in project appending several buttons div:

$(".tab-content").append("<div class='landing_content'><button class='off-screen-nav-button btn btn-info btn_edit' data-effeckt='effeckt-off-screen-nav-right-overlay'>edit</button></div>"); 

and listen click following code:

$(".tab-content").on("click",".btn-edit",function(){   console.log('edit'); }); 

why not working? used use .live() has been deprecated.

thanks.

in markup have btn_edit , in jquery have btn-edit.

change markup class match jquery selector, this:

$(".tab-content").append("<div class='landing_content'><button class='off-screen-nav-button btn btn-info btn-edit' data-effeckt='effeckt-off-screen-nav-right-overlay'>edit</button></div>"); 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -