jQuery selectors and text nodes
Hi,
I have a question about what is either a missing feature or a design rationale.
jQuery selectors appear to be centered around elements and do not
include text nodes. For instance, if I have HTML such as this one:
<li><b>ISBN-10:</b> 0743226720</li>
and I would like to select the next text node after the <b> element
that contains ISBN-10, I'd have to do:
var isbnBLabel = $("b:contains('ISBN')");
var isbnVal = isbnBLabel[0].nextSibling.nodeValue;
I'd much rather do something like
var isbnVal = $("b:contains('ISBN')").next("#text").text();
but I haven't found a way to do that; the jQuery documentation also
consistently talks about elements. My question is whether there's a
way to use jQuery to select text nodes, and if not, what's the design
rationale for eliding such support?
- Godmar