Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#8361 closed bug (duplicate)

ID selector not working for ID having colon or period

Reported by: anonymous Owned by:
Priority: low Milestone: 1.next
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 http://www.w3.org/TR/html4/types.html#h-6.2 this should be allowed.

Try this :

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

<script> alert($('#abc:xyz').html()); alert(document.getElementById('abc:xyz').innerHTML); </script>

Change History (4)

comment:2 Changed 12 years ago by jitter

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 !"#$%&'()*+,./:;[email protected][\]`{|}~ ) as a literal part of a name, you must escape the character with two backslashes

Check this working test case

comment:3 Changed 12 years ago by jitter

Duplicate of #5241.

comment:4 Changed 12 years ago by [email protected]

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.

Note: See TracTickets for help on using tickets.