Call my function from JQUERY on click and pass in data - Javascript jQuery

Javascript examples for jQuery:Mouse Event

Description

Call my function from JQUERY on click and pass in data

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-compat-git.js"></script> 
      <script type="text/javascript">
    $(window).on('load', function() {

$("input").on('click', {name: 'me'}, func);

function func(event) {//w  ww  .  j a v a 2s  . c  o m
    console.log(event.data.name);
}
    });

      </script> 
   </head> 
   <body> 
      <input type="button">  
   </body>
</html>

Related Tutorials