Bug Tracker

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#12306 closed bug (invalid)

incorrect return from selector

Reported by: shalanga@… 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 7 years ago by gibson042

Component: unfiledselector
Resolution: invalid
Status: newclosed

comment:2 Changed 7 years ago by shalanga@…

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 7 years ago by gibson042

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.

comment:4 Changed 7 years ago by shalanga@…

Indeed.

Thanks for the feedback.

I'll check it.

Note: See TracTickets for help on using tickets.