This is the simplest of ideas, but I'm new to jQuery (I probably
shouldn't admit that), and I want to know, when working with the power
of the "$" how does one return a reference.  I hope I'm saying this
correctly.  Allow me to illustrate:

Let's say one grabs a paragraph with the ID "thisIsMyParagraph"

Using CSS traversing, like thus: $("p#thisIsMyParagraph")

Yes?  With me?

Now jQuery provides a whole library to then work with that paragraph.
For example, if I wanted to hide the paragraph, go like thus: $
("p#thisIsMyParagraph").hide();

Correct?

Now, HERE'S THE QUESTION.  What if I want to call native functions to
the DOM object behind the scenes.  The obvious way is to go: var
element = document.createElement("thisIsMyParagraph");

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?

Just trying to understand.  Thanks.

Reply via email to