Skip to main content

Bug Tracker

Side navigation

#8924 closed bug (invalid)

Opened April 20, 2011 10:50AM UTC

Closed May 05, 2011 07:52AM UTC

.val(value) fails intermittently on .each loop

Reported by: sam.barber@thomsons.com Owned by: sam.barber@thomsons.com
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

Attachments (0)
Change History (2)

Changed April 20, 2011 01:56PM UTC by addyosmani comment:1

owner: → sam.barber@thomsons.com
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.

Changed May 05, 2011 07:52AM UTC by trac-o-bot comment:2

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!