Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

Commit

Permalink
Finally a solution for setting selected in dynamically created select…
Browse files Browse the repository at this point in the history
… with IE?
  • Loading branch information
tuupola committed Oct 1, 2007
1 parent d0ee594 commit 7d8f735
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions jquery.jeditable.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,15 @@
continue;
}
var option = $('<option>').val(key).append(json[key]);
if (key == json['selected']) {
/* TODO: why does not this work? */
//option.attr('selected', 'selected');
option[0].selected = true;
}
$("select", this).append(option);
}
}
/* Loop option again to set selected. IE needed this... */
$("select", this).children().each(function() {
if ($(this).val() == json['selected']) {
$(this).attr('selected', 'selected');
};
});
}
}
},
Expand Down

0 comments on commit 7d8f735

Please sign in to comment.