Two questions I had when starting with jQuery, and glancing through the API docs, I still don't see them documented (maybe in a tutorial?):

(1) How do you select an element by its ID?
(2) How do you select all elements given a CSS class?


This leads to an interesting documentation question: How do we explain JQuery to people who don't know CSS? Part of the initial appeal of JQuery for me was exactly the use of CSS for selecting the DOM elements, with the promise that if that ever is not enough, I have much of XPath available. But a certain basic concept is just assumed at almost all levels of JQuery documentation, namely that, for example, "div#myId .myClass" represents all elements inside the div whose id is "myId" which have class "myClass".

The link near the beginning of the Selectors page to the Wikipedia CSS article is fine, but is easy to overlook for the user who doesn't really know what they need CSS for in the first place.

I don't have any particular suggestions, but it might be worth considering the most basic of CSS primers on the Selectors page.

  -- Scott

Reply via email to