Skip to main content

Bug Tracker

Side navigation

#3621 closed bug (invalid)

Opened November 18, 2008 05:13PM UTC

Closed November 19, 2008 10:33PM UTC

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>

Attachments (0)
Change History (2)

Changed November 18, 2008 05:22PM UTC by andrew_ comment:1

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.

Changed November 19, 2008 10:33PM UTC by flesler comment:2

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.