In order to access the underlying DOM object, you use the .get(n) method on the
jQuery object.
$("#editarticle/form").get(0).elements.length;
$("#editarticle/form").get(0).reset();
Or, using jQuery, you could get all relevant form elements like so:
$("#editarticle/form :input");
And reset them like so:
$("#editarticle/form :input").val('');
m.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Truppe Steven
Sent: Saturday, November 11, 2006 4:57 AM
To: jQuery Discussion.
Subject: Re: [jQuery] Loop through all elements of a form
Aaron Heimlich schrieb:
> On 11/10/06, *Ⓙⓐⓚⓔ* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>
> wrote:
>
> I don't think jq can get back the
> original default values.
>
>
> True, but I believe he wanted a way to *empty* the elements, not
> return them to their defaults.
> ----------------------------------------------------------------------
> --
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
You are right, i just want to empty all input/textarea fields. I'm trying to
use the "elements" attribute but i get an error telling me that the property is
not known:
var x = $("#editarticle/form").elements.length;
I'm also not able to run the reset() function with:
$("#editarticle/form").reset();
Do i refer to the wrong object ? Or how to get the dom properties out of an
jquery object ? i'm relative new to the javascript thing so i think i'm missing
some basics.
best regards,
Truppe Steven
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/