@michaell
I Haven't see your comment but you're right. In my example I show
two options to get/retrieve the values of the :input fields that I use
trying to set a perspective of the problem. The first one within a
function and a second example directly on a specific field. Saving the
whole inpu
@Alwin, it seems like all you're doing is abstracting my original
suggestion of storing the original value in the data object for the
corresponding input into another method that then uses the data method
(e.g. the holdData function has my original suggestion as its only
content). I'm not seeing f
Try to use something like this...
var form = function() {
var self = this;
this.holdData = function() {
$(':input').each(function(i, field) {
$(this).data('value', $(this).val())
});
return self;
};
this.retrieveData = function() {
$(':input').each(function(i, f
How about just clone-ing the form node and replace the current form
with the clone when you want to 'reset' it?
On Mar 10, 5:31 pm, Brad wrote:
> mkmanning's plugin, along with his recommendation to use jQuery's data
> method instead of a global object, will work nicely.
>
> To answer my other
mkmanning's plugin, along with his recommendation to use jQuery's data
method instead of a global object, will work nicely.
To answer my other question re: getting the full html of an element,
there is this plugin: http://plugins.jquery.com/project/outerhtml.
On Mar 10, 1:16 pm, Brad wrote:
> I
I'll have a look. It sounds like this is the basis for what I need.
Thanks.
On Mar 10, 12:58 pm, mkmanning wrote:
> Haven't tried it but you could use my getAttributes plugin (http://
> plugins.jquery.com/project/getAttributes) to store the current
> attributes in the data as I suggested, and th
Thanks for pointing out about that $(this) is pointer.
On Mar 10, 12:50 pm, MorningZ wrote:
> Reading up on the documentation would be a good thing, as knowing the
> basics, like knowing what ".html()" does, is absolutely required if
> you want to learn to use this library to the fullest
>
> As
Form elements have "defaultValue" and "defaultSelected" attributes.
You might want to explore using those to "reset" the elements.
http://www.irt.org/script/909.htm
Karl Rudd
On Wed, Mar 11, 2009 at 5:58 AM, mkmanning wrote:
>
> Haven't tried it but you could use my getAttributes plugin (http:
Haven't tried it but you could use my getAttributes plugin (http://
plugins.jquery.com/project/getAttributes) to store the current
attributes in the data as I suggested, and then retrieve it later.
That would get you not only the value but all other attributes.
$(document).ready(function(){
Reading up on the documentation would be a good thing, as knowing the
basics, like knowing what ".html()" does, is absolutely required if
you want to learn to use this library to the fullest
As for
"If I store the value of $(this) as shown I can later retrieve the
value
for a specific field by
Thanks for the help on the other question. I missed the part about
reverting the value.
Actually I don't think that I need to explicitly store the value. If I
store the value of $(this) as shown I can later retrieve the value
for a specific field by e.g., calling ...
$(origFormData['age']).val(
Rather than create a global object, why not just take advantage of the
jQuery data method and store the original value with its corresponding
form element:
$(":input").each(function(){
$(this).data('origVal',this.value)
});
On Mar 10, 11:02 am, MorningZ wrote:
> You forgot an important
You forgot an important part of the line
origFormData[this.name] = $(this);
and this is you need to store the value, so
origFormData[this.name] = $(this).val();
and on your other topic, the code was also provided to revert the
value back to the saved value
On Mar 10, 1:36 pm, Brad wrote:
>
I'm thinking that
$("form input").each(function() { $(this).val(origFormData[$(this).attr
("id")]); });
should step over each input field in a form and conjure up values from
the origFormData object based on the id of the current element
conjuring a value.
But the state-saving code should be mo
14 matches
Mail list logo