Why this code works (see code at jsfiddle)
$(document).ready(function() {
var html = '<div><a href="javascript:">click me</a></div>';
var $div = $(html);
$div.find('a').bind('click', function() { //attention on bind
alert('Hi');
});
$('#test').append($div);
});
but the same code with .bind('click' replaced with .live('click' is not working? Why?
Thank you.
jQuery documentation says:
So if you change
$div.find('a').bind('click'to$('#test a').live('click'it would work.