I have a
<input type='text' id='text' value='' />
How do I programmatically set the value attrribute using JQuery/Javascript
I have a
<input type='text' id='text' value='' />
How do I programmatically set the value attrribute using JQuery/Javascript
It's as easy as this:
$("#text").attr("value", "some value");
The Javascript would be:
document.getElementById('text').value = 'Blahblah';
In jQuery, you'd do it like this:
$("#text").val("my new value");
You might also want to read the jQuery documentation on this topic
Without jQuery:
document.getElementById("text").setAttribute("value", "my new value");
Hope that helps.