Bug Tracker

Opened 14 years ago

Closed 14 years ago

#3621 closed bug (invalid)

Plus Sign in Element ID, Element Reference Issue

Reported by: andrew_ Owned by:
Priority: major Milestone: 1.3
Component: docs Version: 1.2.6
Keywords: plus sign element id Cc:
Blocked by: Blocking:


If an element has a plus sign (+) in it's ID, $('#..') does not return any references to the element. document.getElementById, however, is able to.

Using the following html, I have been able to reproduce the issue;

<html> <body><div id="_f1+1"/>

<script type="text/javascript">

alert($("#_f1+1").length); alert(document.getElementById("_f+1"));

</script> </body></html>

Change History (2)

comment:1 Changed 14 years ago by andrew_


Lists the solution for this, however, the FAQ doesnt make mention of what symbols should be escaped. Perhaps the docs could use an update in that regard.

comment:2 Changed 14 years ago by flesler

Component: coredocs
Resolution: invalid
Status: newclosed

Ok... it's basically all those character that have a special meaning in selectors. They're also invalid characters for IDs, even though browsers do retrieve the element.

If you think this is needed, ask on jQuery's google group.

Note: See TracTickets for help on using tickets.