JQuery delegate what may cause it to not function
- by Jafin
I have a webpage using jquery 1.42
The following 2 segments of code live in my page.
$('body').delegate('h2', 'click', function() {
$(this).after("<p>delegate paragraph!<\/p>");
});
$('body h2').live('click', function() {
$(this).after("<p>live paragraph!<\/p>");
});
The live method always works, yet the delegate doesn't fire at all.
If I create a trivial page with simple html
<body><h2>blah</h2></body>
both approaches work. So I'm assuming there is something else going on in my page.
With firebug I am seeing no javascript errors, no html errors. and breakpoints on the delegate method definately do not get hit.
What else might be the cause of delegate not triggering?