Javascript examples for jQuery Method and Property:click
Trigger the click event for the selected elements
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ $("p").click(); });/* www . j av a 2 s . co m*/ }); </script> </head> <body> <button>Trigger click event for p element</button> <p onclick="console.log('Click event triggered')">This is a paragraph.</p> </body> </html>