Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
114
rated 0 times [  121] [ 7]  / answers: 1 / hits: 46541  / 12 Years ago, fri, january 11, 2013, 12:00:00

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>

More From » html

 Answers
5

Simply add :



   button.style.visibility = hidden;


at the end of your SetInput function.


[#80938] Thursday, January 10, 2013, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
trevionbronsonr

Total Points: 160
Total Questions: 85
Total Answers: 110

Location: Bonaire
Member since Wed, Mar 29, 2023
1 Year ago
;