How do you convert an input button to a text?

T

Thierry Lam

I have the following:

<input type="button" value="Convert me" id="convert" />

How do I convert the above to text by clicking on the button?

I want the button to show text "Converted".

Thierry
 
D

David Mark

How about :

<input type="button" value="Convert me" id="convert"
onMouseUp=changeValue()>

function changeValue(){
document.getElementById("convert").value="Converted";

}

N

Or better still:

<input type="button" value="Convert me" onclick="this.value =
'Converted'">

This will work for users without a mouse and does not require an extra
function or support for document.getElementById.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,416
Latest member
LionelQ387

Latest Threads

Top