You can use .delegate() to process items dynamically added to the #playlist_header container.
$("#playlist_header").delegate('#renameCurrent', 'click', function(){ alert('hello'); });
Or just add a .click() handler when creating the item.
$("#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="+">'); $aa.filter('#renameCurrent').click(function() { alert('hello'); }); $("#playlist_header span").html($aa);
source share