JQuery .click() and custom function - Javascript jQuery

Javascript examples for jQuery:Mouse Event

Description

JQuery .click() and custom function

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-git.js"></script> 
  <script type="text/javascript">
$(document).ready(function(){
    $('#but').on('click', function() { buttonClick(); });
     buttonClick = function() {/*  w w  w. ja v a  2s . c o m*/
        console.log("Hello!");
        $('#res').html("BUTTON!!!").fadeIn('fast');
    };
});

      </script> 
 </head> 
 <body> 
  <button id="but">button</button> 
  <div id="res"></div>  
 </body>
</html>

Related Tutorials