select box auto selected as a default
I want when adding a new item with jquery
$("#dve option").dblclick(function() {
$(this).clone().appendTo("#edno");
});
The item to be 开发者_开发百科added, as selected to the select box, how to do that ?
see jQuery.prop()
in jQuery v1.6
$(this).clone().appendTo("#edno").prop('selected',true)
see also the performance between attr()
and prop()
here
you can use that..
$(this).clone().appendTo("#edno").attr('selected',true);
hope its work
精彩评论