I am added json object data and three buttons for every li tag in my webpage. My requirement is , I want to get that dynamically added button . But i am not getting that button by using $("but1").click(function(){ alert("hi iam getting dynamic added button"); });. So please give me some suggession to acheive this.
+1
A:
You need the live()
method for dynamic generated elements:
$("#but1").live('click', function(){
alert("hi iam getting dynamic added button");
});
live()
Description: Attach a handler to the event for all elements which match the current selector, now or in the future.
Sarfraz
2010-07-18 06:07:47