Side navigation
#7581 closed bug (invalid)
Opened November 20, 2010 09:28AM UTC
Closed November 20, 2010 05:08PM UTC
Last modified November 20, 2010 07:06PM UTC
.size() returns 1 on multiple objects
Reported by: | dominik.kukacka@gmail.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | 1.5 |
Component: | unfiled | Version: | 1.4.4 |
Keywords: | Cc: | anonymous | |
Blocked by: | Blocking: |
Description
Hey,
I don't know if this is a bug but I think so.
I tried to select <input name="names[]"/> with $('input[name=names\\\\[\\\\]').size() and it returns zero!
The same with an ID But then it returns 1. <input id="names"/> with $('#names').size()
It works if I do it with a class (.names)
Here is a demo: http://lab.codecookie.net/jquery_array_selector/
greets
Attachments (0)
Change History (6)
Changed November 20, 2010 05:08PM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
Changed November 20, 2010 05:11PM UTC by comment:2
yeah but if you had looked at my example you would have seen that I escaped it! $("input[name=names\\\\[\\\\]]").size()
greets
Changed November 20, 2010 05:13PM UTC by comment:3
ok here it looks not the right way.
I put two backslashes before each [ and ]
greets
Changed November 20, 2010 05:40PM UTC by comment:4
cc: | → anonymous |
---|
If you would like us to re-open this ticket, please re-recreate your test case on jsFiddle.net so that we can evaluate it correctly. Note: the bug tracker is known to remove/interpret certain characters differently so characters you may have used in your original submission may not have been visible to us.
This is not a bug, just an improperly escaped selector.
If you have a look at http://api.jquery.com/category/selectors/, you can see your exact example is covered:
"If you wish to use any of the meta-characters (#;&,.+*~':"!^$[]()=>|/@ ) as a literal part of a name, you must escape the character with two backslashes. For example, if you have an an input with name="names[]"...", etc.
The #jquery IRC channel on Freenode or the support forums are also a great way to ask these types of questions.
Cheers.