views:

46

answers:

1

Is there anyway by which i can use the $ or $$ utility selectors with arguments containing special characters?

<div id="my example">

$('my example')

<div class="item1\item2">

$$('div.item1\item2')

I've tried using the standard escape sequence \ but am having no luck.

+2  A: 

Arguments to those functions can contain ids of elements. As the spec says:

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

This implies that special characters within ids are not allowed.

Marcel Korpel
Have just run the source through the W3c validator:This attribute can not take a space-separated list of words as a value, but only one word ("token"). This may also be caused by the use of a space for the value of an attribute which does not permit itWell i guess that explains that one then
Ikkoras