Bug Tracker

Modify

Ticket #3621 (closed bug: invalid)

Opened 5 years ago

Last modified 4 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 5 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 4 years ago by flesler

  • Status changed from new to closed
  • Resolution set to invalid
  • Component changed from core to docs

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.