jQuery Event delegate() Method
When a specific function to run then the events occurs. The delegate() attaches one or more event handlers for specified elements that are children of selected elements.
It is work in both current and FUTURE elements (new element created by a script) when event handler attached using the delegate().
Syntax
$(selector).delegate(childSelector,event,data,function) |
Example
<!DOCTYPE html> <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function () { $("div").delegate("button", "click", function () { $("p").slideToggle(); }); }); </script> </head> <body> <div style="background-color:Red"> <div style ="font-family :Gigi "> <p>This is my first paragraph.</p> </div> <button>Click me</button> </div> </body> </html> |

Join the conversation! Your thoughts help the community grow.