I have to change the text of several buttons to whatever I type into a 'textbox'. When I click the first button, the text from the textbox should become the text of the button. The HTML code:
<input id="textbox" type="text" size="30" />
<br/>
<button id="b1">Button 1</button>
<br/>
<button id="b2">Button 2</button>
<br/>
<button id="b3">Button 3</button>
<br/>
<button id="b4">Button 4</button>
<br/>
<button id="b5">Button 5</button>
<br/>
I know how to create alerts in javascript using functions and
document.getElementById("b1").onclick = click;
but how do I make the button of the text change? What command can I use inside an if statement instead of alert which would replace the text of the button with the text inside the textbox? I have looked all over but can't find the answer. Any help is appreciated :)