Skip to main content

Bug Tracker

Side navigation

#9317 closed bug (invalid)

Opened May 17, 2011 04:43PM UTC

Closed May 17, 2011 07:17PM UTC

append on select element does not set value

Reported by: ydg Owned by: ydg
Priority: low Milestone: 1.next
Component: attributes Version: 1.6.1
Keywords: Cc:
Blocked by: Blocking:
Description

This code snippet works in 1.5.2 but does not set the value in 1.6.1.

Reproduced in FF4, IE7, chrome 10

function(result) {

var options = $("#Select");

$.each(result, function() {

options.append($("<option />").val(this.PK).text(this.ITEM));

})

Attachments (0)
Change History (3)

Changed May 17, 2011 04:51PM UTC by timmywil comment:1

component: unfiledattributes
owner: → ydg
priority: undecidedlow
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.

I created this test case, but was unable to reproduce the issue: http://jsfiddle.net/timmywil/v2fYh/

Changed May 17, 2011 06:54PM UTC by ydg comment:2

status: pendingnew

Tried to duplicate on jsFiddler but not sure if its my syntax or jsFiddler but I cannot duplicate it there no matter what jquery library is used.

In Summary though, the result object is a json object returned from the server within a .ajax call that populates the select. $(select).text() works fine but .val() will not populate in 1.6.1

Changed May 17, 2011 07:17PM UTC by timmywil comment:3

resolution: → invalid
status: newclosed

I've created another test case based on your description and everything seems to be working properly.

http://jsfiddle.net/timmywil/wtfnp/

If a test case is provided that reproduces the issue, we can look into it further.