Run ❯
Get your
own
website
Result Size:
625 x 565
×
Change Orientation
Save Code
Change Theme, Dark/Light
Go to Spaces
<!DOCTYPE html> <html> <body> <form id="myForm" action="/action_page.php"> 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 set the value of the target attribute in the form to "_blank".</p> <p><b>Note:</b> Click "Submit" before and after you have clicked on the "Try it" button.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("myForm").target = "_blank"; document.getElementById("demo").innerHTML = "The value of the target attribute was changed."; } </script> </body> </html>