w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
jQuery.on use with parent and child selectors vs just child selector

The first one is called event delegation, if your childSelector elements added to DOM later,

  • the first one will work (new added elements have event handlers) - JSFiddle.
  • but the second one won't (new added elements doesn't have any event handler) - JSFiddle.

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.