Skip to main content

Bug Tracker

Side navigation

#8361 closed bug (duplicate)

Opened February 23, 2011 11:39AM UTC

Closed February 23, 2011 11:50AM UTC

Last modified March 02, 2011 04:48AM UTC

ID selector not working for ID having colon or period

Reported by: anonymous Owned by:
Priority: low Milestone:
Component: selector Version: 1.5
Keywords: Cc:
Blocked by: Blocking:

jquery ID selector is not selecting html elements which has id having colons (:) or periods (.)

As per w3c this should be allowed.

Try this :

<div id="abc:xyz">123</div>





Attachments (0)
Change History (4)

Changed February 23, 2011 11:42AM UTC by comment:1

The jsFiddle url is:

Changed February 23, 2011 11:50AM UTC by jitter comment:2

component: unfiledselector
priority: undecidedlow
resolution: → duplicate
status: newclosed

Thanks for taking the time to contribute to the jQuery project by writing a bug report and providing a test case!

Your selector is invalid, the documentation is pretty clear about these kind of selectors:

If you wish to use any of the meta-characters ( such as !"#$%&'()*+,./:;?@[\\]^`{|}~ ) as a literal part of a name, you must escape the character with two backslashes

Check this working test case

Changed February 23, 2011 11:50AM UTC by jitter comment:3

Duplicate of #5241.

Changed March 02, 2011 04:48AM UTC by comment:4

Just in case anyone's going crazy like me, this DID work in before 1.5. I do not object to this ticket being closed for the reason cited--I just want to put others at ease who have discovered the change in behavior as I have.