Javascript examples for jQuery Method and Property:trigger
Trigger custom event and pass in custom data
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").click(function(){ $("p").on("myPara", function(event, param1, param2, param3){ console.log(param1 + "\n" + param2 + "\n" + param3); });/*from www . j a va2 s. co m*/ $("p").trigger("myPara", ['A', 'V', 'C']); }); }); </script> </head> <body> <p>Click to trigger event with additional parameters.</p> </body> </html>