The .click() and similar functions like .hover() allows to access the elements which are already present. But elements created using .append(), .after(), .before() etc are newly inserted into the page.

These newly created elements cannot be accessed using the functions .click(), .hover() as they target only the already present elements. Hence, to resolve this problem jQuery introduces a function .live() which can be used to access the newly created elements.

Demo

Resources:

  1. .live() in jQuery Doc
  2. Using Delegate and Undelegate in jQuery 1.4.2
  3. jQuery Live() Method And Event Bubbling
  4. On jQuery’s live()
  5. Tip for jQuery Live Event

Subscribe for updates

Get updates on the WordPress plugins, tips and tricks to enhance your WordPress experience. No spam.

Add your comment No Comments so far