开发者

select box auto selected as a default

开发者 https://www.devze.com 2023-03-08 14:04 出处:网络
I want when adding a new item with jquery $(\"#dve option\").dblclick(function() { $(this).clone().appendTo(\"#edno\");

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

0

精彩评论

暂无评论...
验证码 换一张
取 消