Side navigation
#10862 closed bug (invalid)
Opened November 22, 2011 06:39PM UTC
Closed November 22, 2011 06:52PM UTC
Sytax bug
Reported by: | lakhtionov@gmail.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
jQuery has a problem dealing with the "+" character.
ex.
<input id="hello+2" value="wagon" />
alert($('#hello+2').val()); displays: undefined
alert(document.getElementById('hello+2').value); displays: wagon
Attachments (0)
Change History (1)
Changed November 22, 2011 06:52PM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
Thanks for taking a moment to try to help the jQuery project, but this is not a valid bug. + is a selector (for adjacent siblings). As is stated in the selectors docs (http://api.jquery.com/category/selectors/):
If you wish to use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[\\]^`{|}~ ) as a literal part of a name, you must escape the character with two backslashes: \\\\. For example, if you have an element with id="foo.bar", you can use the selector $("#foo\\\\.bar"). The W3C CSS specification contains the complete set of rules regarding valid CSS selectors.
It works fine once you do the escaping: http://jsfiddle.net/xvk3Z/
In the future please provide a test case and search the documentation before filing a bug.