Javascript examples for DOM HTML Element:Input URL
Input URL required Property - Set a URL field to be a required part of form submission:
<!DOCTYPE html> <html> <body> <form action="#"> Homepage: <input type="url" id="myURL" name="website"> <input type="submit"> </form>/*from w ww . j a v a2 s . com*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myURL").required = true; document.getElementById("demo").innerHTML = "The required property was set."; } </script> </body> </html>