Javascript examples for DOM HTML Element:Input Search
Input Search required Property - Set a search field to be a required part of form submission:
<!DOCTYPE html> <html> <body> <form action="#"> Search: <input type="search" id="mySearch" name="filter"> <input type="submit"> </form>/*from www. j a v a 2s .c o m*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("mySearch").required = true; document.getElementById("demo").innerHTML = "The required property was set."; } </script> </body> </html>