Javascript examples for jQuery Method and Property:click
Trigger a function automatically by class and id
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script> <script type="text/javascript"> window.onload=function(){// w w w . ja va 2 s. c om $(".Alpha, .Beta").click(function(event) { console.log('clicked'); }); } </script> </head> <body> <span id="my_id" class="Alpha">Test</span> <br> <span id="my_id" class="Beta">Test 1</span> </body> </html>