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?

Johnny Chen
  • 2,025
  • 1
  • 18
  • 27
  • Why the down-votes!? It's a clear a concise question. So it is an obvious error, so what? Answer it! – George Feb 27 '14 at 08:46
  • @Pilot In what way is this 'low quality'? – George Feb 27 '14 at 08:49
  • @oGeez asking this type of question simply means you dont even read A of javascript before posting it – Deepak Ingole Feb 27 '14 at 08: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... – Mr. Alien Feb 27 '14 at 08:57

2 Answers2

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

Mr. Alien
  • 153,751
  • 34
  • 298
  • 278
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>
Rahul Wagh
  • 470
  • 1
  • 6
  • 23