Increment jQuery variable - Javascript jQuery

Javascript examples for jQuery:Variable

Description

Increment jQuery variable

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">
    $(window).on('load', function() {
var x = 0;//from   w w w. java  2  s.  c o  m
$("#browse-right").click(function() {
  x = x + 1;
  $("#pic").html(x);
});
    });

      </script> 
   </head> 
   <body> 
      <button id="browse-right">Click me</button> 
      <div id="pic"></div>  
   </body>
</html>

Related Tutorials