Bug Tracker

Opened 11 years ago

Closed 11 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:

Description

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 11 years ago by andrew_

http://docs.jquery.com/Frequently_Asked_Questions#How_do_I_select_an_element_that_has_weird_characters_in_its_ID.3F

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 11 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.