Sunday, 15 September 2013

confusion on delegation by using the new on method

confusion on delegation by using the new on method

I have a li (<li>) that contain a checkbox, and the li I used on() with an
event, like this:
$('li').on('click', 'li', function(){
});
what happen if I don't put the 2nd parameter which is li?
I click on my checkbox which I also apply to click(), the li's event fire..
how delegation work? I'm confused with the uses of on() since the delegate
method had been deprecated..

No comments:

Post a Comment