Ursine rambling and grumbling

This week's DZone RefCard is one that Yehuda and I put together describing the jQuery Selectors.

For anyone using jQuery, or even contemplating using it, this "RefCard" is a handy reference to keep at your desk (virtual or otherwise) to look up the syntax of the jQuery selectors and the methods that manage the jQuery wrapped set.

DZone RefCardz Page

jQuery Selectors Refcard

 

I quickly read the refcardz and found two problems with it. On page 2.
$(‘div~p’) selects all <div> elements that are preceded by a <p> element
This selector matches all <p> elements that are preceded by any <div> sibling. On page 3:
$(‘#xyz p :header’) selects all header type elements within <p> elements that are within an element with an id value of xyz.
This is not a very good example as <p> elements should not contain block-level elements, see the W3 reference.
And a third error: On page 3.
$(‘p:contains(coffee)’) selects all

elements that contain the text coffee

This should be...
$("p:contains('coffee')")
See the jquery API reference on this.


Add a comment

Title
Body
HTML : b, i, blockquote, br, p, pre, a href="", ul, ol, li
Math Quiz 1 + 6 = (Helps stop blog spam)
Name
E-mail address
Website
Remember me Yes  No 

E-mail addresses are not publicly displayed, so please only leave your e-mail address if you would like to be notified when new comments are added to this blog entry (you can opt-out later).

TrackBack to http://radio.javaranch.com/bear/addTrackBack.action?entry=1213031402070