I’m adding new element through html() function of jQuery. Then I want to handel it. Is it possible to do that in way you see here?
$("#renamePlaylist").click(function(){
var aa = '<input type="text" name="plst_name" value="'+$("#playlist_header").find("span").text()+'" size="'+Math.round($("#playlist_header").find("span").text().length/2)+'">'+
'<input id="renameCurrent" type="image" name="+" value="submit" alt="+">';
$("#playlist_header").find('span').html(aa);
});
$("#renameCurrent").click(function(){
alert('hello')
});
You can use
.live(), like this:Or, run the bind after you create it, like this: