I wanted to know if there was a way I could adapt this code so that when the submit button was clicked, it would disappear, but the input box would remain.
<script type="text/javascript">
var Text = 'hello';
function setInput(button) {
var buttonVal = button.name,
textbox = document.getElementById('input_' + buttonVal);
textbox.value = Text ;
}
</script>
<html>
<input class='input' id="input_a1" name="a1" value="<?php {echo $a1;} ?>">
<input type='submit' name='a1' value='x' onclick='setInput(this); return false;'>
</html>
Simply add :
button.style.visibility = "hidden";
at the end of your SetInput
function.
<button onclick="style.display = 'none'">Click Me</button>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With