Form target Property - Return the value of the target attribute in a form: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Form

Description

Form target Property - Return the value of the target attribute in a form:

Demo Code

ResultView the demo in separate window

<!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>

Related Tutorials