[jQuery] Re: Can't select an id containing '/' ?
> Just wondering if this is a bug, or me using a html id attribute in a > manner not allowed? Although jQuery will let you escape some of the characters, the W3C 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 ("."). So, a forward slash isn't a valid character in an ID attribute.
[jQuery] Re: Can't select an id containing '/' ?
You have to escape special characters with a double backslash: $('#\\/about\\/') On Feb 2, 4:35 am, starmonkey wrote: > Using jQuery 1.2.6, it would seem that any id containing a forward > slash cannot be selected using jQuery's syntax: > > testing blah > testing about > testing about2 > testing about3 > > $('#/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
[jQuery] Re: Can't select an id containing '/' ?
http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_that_has_weird_characters_in_its_ID.3F This is what you're looking for... $('#\\/about\\/')