So i made this button, and i made the description text change from
{description}
to "No..." upon clicking. This is what i made:
function changeText(txt){
document.getElementById('name').innerHTML = txt;
}
<p>
<b id='name'>{description}</b>.
</p>
<input type='image'
onclick='changeText("No...")'
src='http://i.imgur.com/4y6bzH9.png'
style="margin-left: 540px; margin-bottom: 20px; position: absolute; outline: none;"/>
If you want, you can view what i did on /http://yosougay.tumblr.com/
I tried to make the description text change another time upon clicking another one time on the same button, so i tried adding another onClick, to make the description text change to "Another text" the next time you click the button.
function changeText(txt){
document.getElementById('name').innerHTML = txt;
}
<p>
<b id='name'>{description}</b>.
</p>
<input type='image'
onclick='changeText("No...")';
onclick='changeText("Another text")';src='http://i.imgur.com/4y6bzH9.png'
style="margin-left: 540px; margin-bottom: 20px; position: absolute; outline: none;" />
I tested it, and it didn't work. Please, is it possible to make a JavaScript button that changes the text to different texts every time it is clicked?
So far, I've only been able two make the text change once.