javascript - Bind click events to dynamically created html content -


this question has answer here:

i've got following jquery command bind click event when specific element dynamically created.

$(".bill-remove-icon").live("click", function(){ $(this).parent().hide('slide',function(){$(this).parent().remove()}); }); 

but code gives firebug error :

typeerror: $(...).live not function 

what doing wrong here? if code wrong, pls suggest better method bind events dynamically created elements.

live deprecated, have use delegation .on():

$(document).on("click", ".bill-remove-icon", function(){     $(this).parent().hide('slide',function(){$(this).parent().remove()}); }); 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -