Javascript examples for DOM HTML Element:Form
Form target Property - Return the value of the target attribute in a form:
<!DOCTYPE html> <html> <body> <form id="myForm" action="#"> First name: <input type="text" name="fname" value="Donald"><br> Last name: <input type="text" name="lname" value="Duck"><br> <input type="submit" value="Submit"> </form>/*ww w .ja va 2s . co m*/ <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var v = document.getElementById("myForm").target; document.getElementById("demo").innerHTML = v; } </script> </body> </html>