Javascript examples for jQuery:Mouse Event
Make a class to be clicked when new page load
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> <script type="text/javascript"> $(window).load(function(){/*w w w. ja va2 s .c o m*/ $(".searchIcon").click(function(){ clickFunction(); }); var clickFunction = function(){ console.log("clicked!"); }; clickFunction(); }); </script> </head> <body> <div class="searchIcon"> Icon </div> </body> </html>