Click to update element - Javascript jQuery

Javascript examples for jQuery:Mouse Event

Description

Click to update element

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> 
      <script>
$(document).ready(function(){
    $('#target').click(function() {
    $('#output').html(function(i, val) { return val*1+1 });
});// w  w  w.j  a v a 2s .c o  m
});

      </script> 
   </head> 
   <body> 
      <button id="target" type="button">Click Me</button> 
      <div id="output">
         10
      </div>  
   </body>
</html>

Related Tutorials