<!DOCTYPE html>
<html>
<body>
<form id="myForm" action="/action_page.php" target="_self">
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>
<p>Click the "Try it" button to return the value of the target attribute in the form.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myForm").target;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>