0

I hava a button like this

<input type="Submit" value="Apply" align="MIDDLE">

I want to change the value to something else .

Can I do this ?

<input type="Submit" value=<script>getnewkey("Apply")</script> align="MIDDLE">

It doesn't seem to work, How should I modify the javascript code?

4
  • Why the down-votes!? It's a clear a concise question. So it is an obvious error, so what? Answer it! Commented Feb 27, 2014 at 8:46
  • @Pilot In what way is this 'low quality'? Commented Feb 27, 2014 at 8:49
  • @oGeez asking this type of question simply means you dont even read A of javascript before posting it Commented Feb 27, 2014 at 8:50
  • 2
    I can call this as ummm basics, so though I've posted an answer, make sure you research about this online, you will get tons of posts who will provide you an answer for this, also learn basics of the language you are using to develop your apps/website with, if then you hit a bump, post a question here... Commented Feb 27, 2014 at 8:57

2 Answers 2

3

Ohhh it doesn't work that way, you should assign an id to the element and use

<input type="Submit" id="blow" value="Hello">
                   ------^------

Javascript

document.getElementById('blow').value = 'Apply';

Demo

Sign up to request clarification or add additional context in comments.

Comments

0

Please follow the below code snippet. It will answer your questions

    <HTML>
<HEAD>
<script language=javascript>
function onClickOfSubmit(){
    var renameTheTextBox = 'ChangedName';
    document.getElementById('textBoxId').value = renameTheTextBox;
}
</script>
</HEAD>
<BODY>
<div >
    <input type="Submit" id="textBoxId" value="Submit" align="MIDDLE" onclick='onClickOfSubmit()'>
</div>
</BODY>
</HTML>

2 Comments

It seems the button value will change after I click it,am I right?
yes it will change after the click

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.