Reputation: 1871
I have a form and I want it to not be displayed on submit - how is this possible? :)
<body>
<form method="POST" action="test.php" name="_navn">
<input name="txt" id="input" type="text" value="Write here" onFocus="noValue()" onBlur="changeValue()">
<input type="submit" value="Submit">
<input type="hidden" name="_submit_check" value="1">
</form>
</body>
This is what I want to go away when the hidden input is submitted. How? :)
(the <body>
-tags are not part of what I want to be deleted hehe)
Upvotes: 1
Views: 78
Reputation: 11238
you just want the form and everything in it off the page?
var f = document.getElementsByTagName('form')[0];
f.parentNode.removeChild(f);
otherwise you can just hide it with
f.style.visibility = 'hidden'
or
f.style.display = 'none';
Upvotes: 3