Javascript examples for jQuery:Variable
Increment jQuery variable
<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>