Setting the value of textboxes with one of their attributes (jQuery)
Posted
by Jimbo
on Stack Overflow
See other posts from Stack Overflow
or by Jimbo
Published on 2010-05-06T13:28:25Z
Indexed on
2010/05/06
14:08 UTC
Read the original article
Hit count: 125
I have a bunch of input text boxes that have the attribute ORIGINAL set to their initial value, so that when the user changes the textbox value, jQuery can highlight items that have changed (by comparing the text box's current value to the ORIGINAL attribute's value)
What Im trying to do now is provide the user with a button that they can click to revert all text boxes back to their original values based on the value of the ORIGINAL attribute of each text box.
Example
$('input[type=text]').val($(this).attr('original'));
The above doesnt work and I dont understand why.
© Stack Overflow or respective owner