Javascript examples for jQuery Method and Property:val
Subtracting an integer from a value which is fetched using $(#id).val()
<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(){// w w w. ja va 2 s . co m console.log($("#hid_count").val()); console.log(" ===> " + (parseInt($("#hid_count").val()) - 1)); }); </script> </head> <body> <input type="text" id="hid_count" value="40"> </body> </html>