Bug Tracker

Modify

Ticket #9660 (closed bug: invalid)

Opened 2 years ago

Last modified 2 years ago

jQuery selector "[value=foo]" doesn't work if value set on runtime

Reported by: Suschev.Artem+jQuery_bt@… Owned by:
Priority: low Milestone: 1.next
Component: selector Version: 1.4.3
Keywords: Cc:
Blocking: Blocked by:

Description

With jQuery 1.4.2/1.2.6 and others this will work (if "foo" typed by user on runtime):

$('input[value=foo]')

But with 1.4.3 and higher this doesn't work.

Try it yourself:

 http://jsfiddle.net/VwVhD/11/ - this one with 1.2.6

 http://jsfiddle.net/VwVhD/14/ - this one with 1.6

Change History

comment:1 Changed 2 years ago by timmywil

  • Priority changed from undecided to low
  • Resolution set to invalid
  • Status changed from new to closed
  • Component changed from unfiled to selector

The value attribute does not stay up-to-date with the current value. It is only responsible for setting the default or initial value. You are thinking of the value property, which cannot be used in a selection. You can do something like this instead:  http://jsfiddle.net/timmywil/VwVhD/15/

comment:2 Changed 2 years ago by anonymous

Thx! Also, this will allow $('input[value=foo]') to work -  http://jsfiddle.net/VwVhD/25/

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.