I have a need to reset individual form objects to their original
state. When the document loads I save the element like this:

        var origFormData = {};

        $(document).ready(function(){

                // Save original form data for each input field
                $(":input").each(function(){
                        origFormData[this.name] = $(this);
                });

        });

For example I have a form with fields named name, age, and dept
selectable by $("#name"), $("#age"), and $("#dept") respectably.

How would I go about later restoring/resetting a specific field. Is
there a simple way to overwrite the object represented by $("#name)
with origFormData.name?

Reply via email to