Sunday, February 1, 2009

[jQuery] Can't select an id containing '/' ?

Using jQuery 1.2.6, it would seem that any id containing a forward
slash cannot be selected using jQuery's syntax:

<div id="blah">testing blah</div>
<div id="/about/">testing about</div>
<div id="/about2">testing about2</div>
<div id="about3/">testing about3</div>

$('#/about/') <- jQuery obj with length=0 returned
$('#/about2') <- jQuery obj with length=0 returned
$('#about3/') <- jQuery obj with length=0 returned
$('#blah') <- works

Just wondering if this is a bug, or me using a html id attribute in a
manner not allowed?

cheers,
SM

No comments: