Ticket #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: | ||
| Blocking: | Blocked by: |
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
comment:1 Changed 2 years ago by timmywil
- Owner set to ydg
- Priority changed from undecided to low
- Status changed from new to pending
- Component changed from unfiled to attributes
comment:2 Changed 2 years ago by ydg
- Status changed from pending to new
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 2 years ago by timmywil
- Status changed from new to closed
- Resolution set to invalid
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.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

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/