Javascript examples for DOM HTML Element:Input Number
Input Number required Property - Set a number field to be a required part of form submission:
<!DOCTYPE html> <html> <body> <form action="#"> Number: <input type="number" id="myNumber" name="quantity"> <input type="submit"> </form>//from ww w . j ava2 s . c o m <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myNumber").required = true; document.getElementById("demo").innerHTML = "set"; } </script> </body> </html>