#12306 closed bug (invalid)
incorrect return from selector
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | selector | Version: | 1.7.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Error reproduced: http://jsfiddle.net/tjuxu/
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()
Change History (4)
comment:1 Changed 10 years ago by
Component: | unfiled → selector |
---|---|
Resolution: | → invalid |
Status: | new → closed |
comment:2 Changed 10 years ago by
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.
comment:3 Changed 10 years ago by
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.
Works for me: http://jsfiddle.net/tjuxu/1/