On May 17, 7:14 am, kali <maya778...@yahoo.com> wrote:
> On May 6, 12:18 am, Karl Swedberg <k...@englishrules.com> wrote:
>
>
>
> > On May 6, 2009, at 12:05 AM,kaliwrote:
>
> > > On May 5, 10:05 pm, mkmanning <michaell...@gmail.com> wrote:
> > >> Accessing the elements by index returns the element itself. To call
> > >> jQuery methods you'd need to do this:
> > >> divs = $('div');
> > >> div2 = divs[2];
>
> > > THIS is what I did........
>
> > > div2 = divs[2]  --> is IGNORED....
>
> > It's NOT ignored. It returns a DOM node ( <div id="test3"> )
> > Please re-read what mkmanning wrote, because he's absolutely correct.
>
> > > pls runhttp://www.mayacove.com/dev/jquery/arrays.htmlonFirefox with
> > > JS console open, you will see it says:
> > > div2.addClass' is not a function... this is b/c the line div2 = divs
> > > [2]  is IGNORED...
>
> > No again. It's because you can't attach a jQuery method to a DOM node.
>
> so this   divs = $('div');   is a query object but not this:
>
>    div2 = divs[2];
>
> i.e., var 'divs' is a query object (an array, supposedly, which all
> jQuery wrappers return, right?)
>
> but AN ELEMENT in that array (a jQuery object) is not a jQuery
> object?
>
> sorry, this IS a bit confusing....


actually, if you look here,
http://www.manning-sandbox.com/thread.jspa?threadID=32220&tstart=0

it looks like here the reference to an array element is NECESSARY for
statement to work..  this is because the stmt is plain JavaScript and
not jQuery, right???

and I thought it was so cool you could combine 'plain' JS with jQuery,
but now I see it's a bit tricky...

so, again: a wrapped set is a jQuery object, but an ELEMENT in the
array returned by the wrapper is a plain JS object??

oh brother....          thank you....





Reply via email to