I understand that one way of doing the same thing in jQuery is to
reference it thus: var element = $(p#thisIsMyParagraph)[0];
IS THIS CORRECT? Is there a more correct way, or is this the only
way?
You're spot-on. That is the correct way to get a reference to the
original DOM node.
--John
yes, all of what you said is correct.. an alternative way to access a
single dom element would be $(p#thisIsMyParagraph).get(0) (both ways
to access the dom element are correct).. just one advice, it's much
faster to find the element with just the id, without the tag,.. because
when writing
yes, all of what you said is correct.. an alternative way to access a
single dom element would be $(p#thisIsMyParagraph).get(0) (both ways
to access the dom element are correct).. just one advice, it's much
faster to find the element with just the id, without the tag,.. because
when writing the
On 5/11/07, Dan G. Switzer, II [EMAIL PROTECTED] wrote:
I haven't really spent any time looking through the parsing engine, but
wouldn't it be faster to find elements by ID and then filter by the tag?
IIRC, that's what the selector engine does currently (that or something like
it). p#myId
On 5/11/07, Aaron Heimlich [EMAIL PROTECTED] wrote:
IIRC, that's what the selector engine does currently (that or something
like it). p#myId used to take a very long time because it would go through
every p and look for one with an id of myId. I'm quite sure that jQuery
doesn't do that anymore.
I haven't really spent any time looking through the parsing engine, but
wouldn't it be faster to find elements by ID and then filter by the tag?
IIRC, that's what the selector engine does currently (that or something
like it). p#myId used to take a very long time because it would go
through
Thanks, everyone, for the answers.
On May 11, 1:47 pm, Dan G. Switzer, II [EMAIL PROTECTED]
wrote:
I haven't really spent any time looking through the parsing engine, but
wouldn't it be faster to find elements by ID and then filter by the tag?
IIRC, that's what the selector engine does
7 matches
Mail list logo