Javascript examples for DOM HTML Element:Input Password
Input Password required Property - Set a password field to be a required part of form submission:
<!DOCTYPE html> <html> <body> <form action="#"> Password: <input type="password" id="myPsw" name="usr_psw"> <input type="submit"> </form>/*from w w w.j a v a 2 s.co m*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myPsw").required = true; document.getElementById("demo").innerHTML = "set"; } </script> </body> </html>