Opened 10 years ago
Closed 10 years ago
#12965 closed bug (notabug)
Problem opera and method prepend
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.8.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
$(document).ready(function(){
$.test();
});
$.test = function(){
var form = "<form id='test_jquery'><select class='select' name='select2'></select></form>"; var $form = $(form); $('body').append($form);
var option = [
['Not select 1', 'test', true], ['Select', 'new', false], ['Not select 2', 'test2', false],
]; var $option = $('<option>'); for(i in option){
var $elem = $option.clone(true); $elem.text(option[i][0]); $elem.val(option[i][1]); $elem.addClass(option[i][1]); if(option[i][2] == true){
$elem.attr('selected', true);
} if there append all works $form.find('.select').prepend($elem);
}
var test1 = $('#test_jquery .select2 option:selected').val() == 'test'; true all browsers $('#test_jquery .select2 .new').attr('selected', true); test2 = $('#test_jquery .select2 option:selected').val() == 'new' && $('#test_jquery .select2 option:selected').length == 1; true all browsers but opera false
}
Change History (3)
comment:1 Changed 10 years ago by
Owner: | set to [email protected]… |
---|---|
Status: | new → pending |
comment:2 Changed 10 years ago by
Check in opera (select2) and iPhone safari (radio) http://jsfiddle.net/XVteT/
comment:3 Changed 10 years ago by
Resolution: | → notabug |
---|---|
Status: | pending → closed |
There's way too much code here for a test case. Please ask for help on a forum to determine whether the code is correct before assuming it's caused by a jQuery bug. Also, please do not attach your own unrelated data to the jQuery
($
) object, it is bad practice.
Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket!
Additionally, be sure to test against the "jQuery (edge)" version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to begin.