Skip to main content

Bug Tracker

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:

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()

Attachments (0)
Change History (4)

Changed August 15, 2012 12:34PM UTC by gibson042 comment:1

component: unfiledselector
resolution: → invalid
status: newclosed

Changed August 15, 2012 12:39PM UTC by shalanga@gmail.com 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 gibson042 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 shalanga@gmail.com comment:4

Indeed.

Thanks for the feedback.

I'll check it.