Bug Tracker

Opened 8 years ago

Closed 8 years ago

#8924 closed bug (invalid)

.val(value) fails intermittently on .each loop

Reported by: sam.barber@… Owned by: sam.barber@…
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

Description

I am binding several drop downs and then setting their selected values using the val method. There is an intermittent issue where by one or some of the dropdowns do not get their selected indexes set - some times they all work.

I've tracked the issue to the each loop on line 1677 of jquery-1.4.4.js where it does not find any option elements, however checking the html, and running a .content() reveals there are plenty of option elements.

The issue is even more difficult to track because there seems to be no pattern as to which dropdrop/dropdowns will fail to get their selected values set, sometimes the first one will fail, sometimes to second, sometimes all of them, sometimes none... etc. etc.

Replacing

dropDown.val(value)

with

document.getElementById(dropDown.attr("id")).selectedIndex = value

means the code works everytime so i'm reasonably sure its an issue with Jquery.

Cheers, Sam

Change History (2)

comment:1 Changed 8 years ago by addyosmani

Owner: set to sam.barber@…
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced test case on http://jsFiddle.net that reproduces the issue experienced to help us assess your ticket!

Additionally, test against the jQuery (edge) version to ensure the issue still exists.

comment:2 Changed 8 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

Note: See TracTickets for help on using tickets.