Using JQuery to set 'dirty' elements back to original values
<p>I have a Javascript object that basically represents a Row in an .NET GridView.
When a user clicks on any row in the  grid, all the input elements in that row are 'enabled'.(ie 'Edit' mode). </p>

<p>I run this code depending on which row is selected</p>

<pre><code>$(":input", this._row).attr('disabled', true);
or
$(":input", this._row).removeAttr('disabled');
</code></pre>

<p>So far so good. Now, I want to keep track of the values in that row before a user enters the 'Edit Mode', so i can restore the original values if they decide to click out of that row without saving any changes that they made.</p>

<p>So i capture the original values in an array by doing this:</p>

<pre><code>var $inputs = $(":input", this._row);
var values = {}; 
$inputs.each(function(i, el) { values[el.name] = $(el).val(); });
</code></pre>

<p>the 'values' array now looks like this:</p>

<pre><code>ctl00$ContentPlaceHolder1$resultsGrid$ctl04$COMPONENT1    "56" 
ctl00$ContentPlaceHolder1$resultsGrid$ctl04$COMPONENT2    "98" 
ctl00$ContentPlaceHolder1$resultsGrid$ctl04$COMPONENT3        "08"
ctl00$ContentPlaceHolder1$resultsGrid$ctl04$COMPONENT4    "200"
</code></pre>

<p>Great so far. The user may then modify these values, but decide not to save the changes.
So i need to restore this row back to it's orignal values from the 'values' array.
Can someone tell me the best way to do this? Im hoping it's something simple, but i'm no jquery expert, yet..</p>

<p>thanks</p>
