2011-05-27 230 views
0

我用jQuery選擇默認選擇

$("#dve option").dblclick(function() { 
$(this).clone().appendTo("#edno"); 
}); 

要添加的項目添加一個新的項目時要框汽車,作爲選擇的選擇框,該怎麼做?

+0

@gameboyzgame;看到我的更新 – diEcho 2011-05-27 08:12:04

+0

@gameboyzgame plz upvote如果它是值得的:) – diEcho 2011-05-27 08:26:49

回答

1

看到jQuery.prop()的jQuery V1.6

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

也看到attr()prop()之間的性能here

+0

它說給沒有方法支柱道具錯誤 – gambozygame 2011-05-27 07:48:08

+0

道具方法在'jQuery v1.6中引入;'遺憾忘記提及它 – diEcho 2011-05-27 08:04:43

1

你可以使用..

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

希望其工作