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

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -