Side navigation
#12306 closed bug (invalid)
Opened August 15, 2012 12:30PM UTC
Closed August 15, 2012 12:34PM UTC
Last modified August 15, 2012 12:48PM UTC
incorrect return from selector
Reported by: | shalanga@gmail.com | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | selector | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Error reproduced:
incorrect elements are returned from selector
html to test:
<input type="text" class="input_normal" value="xxx" id="busca" name="busca" />
<INPUT TYPE="text" name="oi[]" id="la" value="meu valor" />
selector used:
$('input[name=oi\\\\[\\\\]]').val()
expected return:
only the second input
what is returned:
all elements...
work around:
Change the selector from:
$('input[name=oi\\\\[\\\\]]')
to: $('input[name=^oi]').val()
Attachments (0)
Change History (4)
Changed August 15, 2012 12:34PM UTC by comment:1
component: | unfiled → selector |
---|---|
resolution: | → invalid |
status: | new → closed |
Changed August 15, 2012 12:39PM UTC by comment:2
Check again: the first "input" must not be selected. Because the name do not match the selector string.
Output is: "xxx" and "works!"
But should be: "works!".
It means "xxx" should not come.
Changed August 15, 2012 12:45PM UTC by comment:3
You have misunderstood something, because the "works!" is placed on all inputs matching the selector (just the one with name "oi[]") and the "xxx" comes from the value you specified. There is no jQuery bug here; please ask for help on the forums or StackOverflow.
Changed August 15, 2012 12:48PM UTC by comment:4
Indeed.
Thanks for the feedback.
I'll check it.
Works for me: http://jsfiddle.net/tjuxu/1/