Problem I’m having is displayed on this fiddle.
http://jsfiddle.net/mjmitche/Sy2G4/
I’m using jQuery delegate() to create paragraphs that will respond to the same click event even though these new paragraphs were created after the document is. I know that delegate has been replaced by on(), but I don’t think on() has that functionality. Anyways, i can’t even get delegate to work the way I want. As you’ll see in the fiddle, the new paragraphs aren’t responsive to the click.
Can you explain what I’m doing wrong?
$(document).ready(function(){
$('p').delegate(this, 'click', function(){
$(this).after('<p>"No click me!"</p>');
});
});
<p>click me!</p>
try this instead: