Make a class to be clicked when new page load - Javascript jQuery

Javascript examples for jQuery:Mouse Event

Description

Make a class to be clicked when new page load

Demo Code

ResultView the demo in separate window

<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>

Related Tutorials