Javascript examples for DOM HTML Element:Input Text
Converting text box value to int
<html> <head> <title>to int()</title> <script type="text/javascript"> function doResults()// w w w .j av a 2 s. c o m { var element = document.getElementById('results'), value = +(element.value) || 0; element.value = value; console.log("The value is " + value); } </script> </head> <body> <input type="text" id="results" class="form-control" name="results" placeholder="results"> <button onclick="doResults();">Check Results</button> </body> </html>