选择自动选择框作为默认值

时间:2011-05-27 07:36:55

标签: jquery html

我想在使用jquery

添加新项目时
$("#dve option").dblclick(function() {
$(this).clone().appendTo("#edno");
});

要添加的项目,如果选择到选择框,该怎么做?

2 个答案:

答案 0 :(得分:1)

请参阅 jQuery v1.6

中的jQuery.prop()
$(this).clone().appendTo("#edno").prop('selected',true)

另请参阅attr()prop() here

之间的效果

答案 1 :(得分:1)

你可以使用..

$(this).clone().appendTo("#edno").attr('selected',true);

希望它的工作