Javascript examples for jQuery Method and Property:delegate
Pass in data for event handler using delegate()
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> function handlerName(e){//from w w w. j a va2 s.c om console.log(e.data.msg); } $(document).ready(function(){ $("p").delegate({msg: "You just clicked me!"}, "click", handlerName) }); </script> </head> <body> <p>Click me!</p> </body> </html>