JQuery delegation inside div> divs> a also :(
HTML:
<div id="a"> <a id="a0" href="#"></a> <div id="b"><a id="b0" href="#"></a><div> <div> JQuery
$('#a').delegate('a', 'click', function(){ //do stuff }); delegates # b0. Is there any smart way to choose ways to ignore #b?
NB /// links inside the div are added and disabled dynamically ///
tee
+4
4 answers
This works as expected. Your delegate() call will set up an event handler for all children in #a that match the a selector.
If you are trying to set a handler for a specific item, then do it
$('#a0').click(function(){ ... }); Also your html is pretty broken. Make sure that closing tags actually close.
0