Javascript examples for jQuery:Form Input
Increment input field value with jQuery
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> <script type="text/javascript"> $(window).load(function(){/*from ww w . java 2s . c om*/ var $input = $('#counter'); $input.val( +$input.val() + 1 ); }); </script> </head> <body> <input id="counter" type="text" name="counter" value="1"> </body> </html>