I would like to change the displayed text of an input submit button from say foo, to bar. BUT I don't want to change the value. Can anyone help?
<input type="submit" name="random" value="foo" />
I would like to change the displayed text of an input submit button from say foo, to bar. BUT I don't want to change the value. Can anyone help?
<input type="submit" name="random" value="foo" />
Sorry, but you can't. You can try this, though:
<button value="foo">bar</button>
copy paste production:
< script type="text/javascript" >
function replaceScript() {
var toReplace = 'value="foo"';
var replaceWith ='value="bar"';
document.body.innerHTML = document.body.innerHTML.replace(toReplace, replaceWith);
}
< /script >
Then initialise in the body tag to do on page load.
<body OnLoad = "replaceScript();">
Should work fine and replace all instances in html body code.
source: find and replace string
<button type="submit" name="random" value="foo">bar</button>
This work for me. Tested on Chrome and Firefox.