Quirky jQuery - Setting the 'value' attribute in HTML
Posted October 17th, 2008 by Chris in
This one stumped the guys over at the jQuery IRC channel:
When you use the jquery to set an element's value attribute, you can do the following:
$(this).attr('value', 'newvalue');
or this:
$(this).val('value');
For most attributes, this will change the actual html. To test it out, you can use Firebug and watch the value change, or print out the new output by doing something like:
- 6143 comments
- Read more



6143 Comments
