gambozygame
gambozygame

Reputation: 489

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 ?

Upvotes: 0

Views: 377

Answers (2)

xkeshav
xkeshav

Reputation: 54022

see jQuery.prop() in jQuery v1.6

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

see also the performance between attr() and prop() here

Upvotes: 1

chhameed
chhameed

Reputation: 4446

you can use that..

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

hope its work

Upvotes: 1

Related Questions