IHYPRESS PROGRAMMING
Tutorials and JavaScript programs with code and output for beginners
c programming
HOME | ASP | C | CSS | GNUPLOT | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
arrow_circle_left
share
arrow_circle_right
JavaScript ❯ Form Validation API
<17>
<!DOCTYPE html> <html> <head><title>Form Validation API</title> <style>p#demo {color:Red;}</style> </head> <body> <p>Enter a number and click OK: <input id="id1" type="number" min="100" max="300" step="10" required> <button onclick="myFunction()">OK</button> </p> <p id="demo"></p> <!-- the validationMessage property contains the default error message. --> <script> function myFunction() { const inpObj = document.getElementById("id1"); if (!inpObj.checkValidity()) { document.getElementById("demo").innerHTML = inpObj.validationMessage; } else { document.getElementById("demo").innerHTML = "Input OK"; } } </script> </body> </html>
Hergestellt in Deutschland / Made in Germany
Form Validation API

Enter a number and click OK:

COPYRIGHT © 2015-2026 IHY PRESS Frankfurt am Main 60329 Deutschland