Javascript examples for DOM HTML Element:Input Email field
Input Email required Property - Set an email field to be a required part of form submission:
<!DOCTYPE html> <html> <body> <form action="#"> E-mail: <input type="email" id="myEmail" name="usremail"> <input type="submit"> </form>/*from w w w .ja v a2s.c o m*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myEmail").required = true; document.getElementById("demo").innerHTML = "The required property was set."; } </script> </body> </html>