With the latest changes to jQuery there are the different methods, .prop() .attr().
What I am wondering is if there is a way to get the original value of the input when the page was loaded?
I know I could do:
$('#input').data('originalValue', $('#input').val());
and then I can refer to it through
$('#input').data('originalValue');
But I thought that since I can say, find out the original checked state of a checkbox I thought maybe there is something similar for the value?
You can use the input element’s
defaultValuepropertyFor example:
Note how by treating the jQuery object as an array we are able to directly access the DOM node and its native property.
See jsFiddle demo