Opened 9 years ago
Closed 9 years ago
#14532 closed bug (notabug)
ID selector fail with ':' in the id
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.10.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
IDs with ':' aren't found by the ID selector. Using HTML5 so IDs should be valid with a number first.
It works in Pure JS and in at least one other framework, Mootools 1.4.5.
Converting a small project from mootools 1.4.5 to jquery 1.10.2 and it caused me a lot of confusion
Note: See
TracTickets for help on using
tickets.
The colon must be escaped: http://jsfiddle.net/Ax3rP/6/.
Always escape selectors as if you were passing them to
querySelectorAll
, notgetElementById
. jQuery will normalize the selector for you and still usegetElementbyId
internally for performance.http://api.jquery.com/id-selector/