jQuery delegate() Method

Last Updated Jul 15, 2015, 04:00:25 PM





jQuery delegate() Method

jQuery delegate() method is used to attach a handler to one or more events for all matched elements.

Syntax

As of jQuery 1.7, delegate() method has been substituted by the .on() method. Earlier version the most effective way to use the event was delegation.

Here is an example to use jquery delegate() method


Example

In the above example, what jquery delegate() method does is , everytime you click on the html body content, it will add another paragraph which contains text "Added another element"

Output
jquery delegate() method

Try It Now

Other Advanced jQuery Events you might want to learn

jQuery Complete Events Reference

jQuery Events

jQuery Document Events

jQuery Keyboard Events

jQuery Mouse Events


Sources and Credits

The content and methods in the tutorial has been referred and updated with jQuery API and The jQuery Foundation

Last Updated Jul 15, 2015, 04:00:25 PM