#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: |
Description
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:1 Changed 12 years ago by
comment:2 Changed 12 years ago by
Component: | unfiled → selector |
---|---|
Priority: | undecided → low |
Resolution: | → duplicate |
Status: | new → closed |
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:
http://api.jquery.com/category/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:4 Changed 12 years ago by
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.
The jsFiddle url is:
http://jsfiddle.net/wjwRb/