guys, for example i want to append the <li> element dynamically and attach the click event
HTML : <ul id="subs"> </ul> JS: $(document).ready(function() { ... //add dummy data for(var i = 0; i < 5; i++) { dataString +="<li><a href='#' rel='"+i+"' title='"+i+"' class='group'>"+i+"</a></li>" }; $('#subs').append(dataString); // the list is visible, now attach click event $("a").filter(".group").click(function() { alert(this.getAttribute('rel')); }); why the alert(this.getAttribute('rel')) is never executed ? please advise.