Bug Tracker

Opened 8 years ago

Closed 8 years ago

#9317 closed bug (invalid)

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

})

Change History (3)

comment:1 Changed 8 years ago by timmywil

Component: unfiledattributes
Owner: set to 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/

comment:2 Changed 8 years ago by ydg

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

comment:3 Changed 8 years ago by timmywil

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.

Note: See TracTickets for help on using tickets.