Sorry about dumping my notes here earlier - not necessary for my question.
Yes setting and retrieving properties works (this.blah). But this
seems to require me to do it within an each() or get(). So I guess you
have answered my initial question if this is the only way to do it.
Perhaps a plugin could provide a way to test for and set properties
such as this? Something similar to attr()...
Maybe prop("property",value) and prop("property") at could be used in
the jQuery chain.
Or would this be redundant?
On 31/12/06, Ⓙⓐⓚⓔ <[EMAIL PROTECTED]> wrote:
> no, I would do it exactly the way you said. I'd assume that this.kids
> = count works... but I was wondering where does the value go, since
> it's not really in the dom as a attribute, does it just get lost?
>
> On 12/30/06, Matt Stith <[EMAIL PROTECTED]> wrote:
> > Hrrrmmm, you mean that you do
> >
> > this.kids = count;
> >
> > then alert(this.kids) doesnt work?
> >
> > If so, make sure 'count' is being set correctly, i dont see why else the
> > value would be lost
> >
> >
> > On 12/30/06, Ⓙⓐⓚⓔ <[EMAIL PROTECTED]> wrote:
> > > easy peasy and perfectly logical.... but what is Oliver's doing? is
> > > the attribute assigned to the object and then lost when the current
> > > $() is done? it would work from one line to the next, right?
> > >
> > > Just curious. You answer is perfect!
> > >
> > > On 12/30/06, Matt Stith <[EMAIL PROTECTED]> wrote:
> > > > easy peasy:
> > > >
> > > > set the value:
> > > >
> > > > $(element).attr('kids',new_value);
> > > >
> > > > and to retrieve the value:
> > > >
> > > > $(element).attr('kids');
> > > >
> > > >
> > > > On 12/30/06, Oliver Boermans <[EMAIL PROTECTED]> wrote:
> > > > > Hi all
> > > > >
> > > > > What is the best way to attach and access my own properties to DOM
> > > > > elements within the confines of jQuery?
> > > > >
> > > > > I'm attempting to write a script which iterates through a multi-level
> > > > > multi-nested ordered list. Starting from the deepest level and working
> > > > > up, I want to store an accumulated value on each element - based on
> > > > > the number of children each ol / li contains.
> > > > >
> > > > > Storing the values within a .each() is working okay:
> > > > > this.kids = count;
> > > > >
> > > > > But retrieving these values is proving to be a problem - for me at
> > > > > least... My JavaScript knowledge gets patchy outside basic DOM
> > > > > manipulation.
> > > > >
> > > > > If this doesn't make sense please quiz me!
> > > > >
> > > > > Is there a better way to handle this kind of thing?
> > > > >
> > > > > Cheers
> > > > > Ollie
> > > > >
> > > > > _______________________________________________
> > > > > jQuery mailing list
> > > > > [email protected]
> > > > > http://jquery.com/discuss/
> > > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > jQuery mailing list
> > > > [email protected]
> > > > http://jquery.com/discuss/
> > > >
> > > >
> > > >
> > >
> > >
> > > --
> > > Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
> > > _______________________________________________
> > > jQuery mailing list
> > > [email protected]
> > > http://jquery.com/discuss/
> > >
> >
> >
> > _______________________________________________
> > jQuery mailing list
> > [email protected]
> > http://jquery.com/discuss/
> >
> >
> >
>
>
> --
> Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/