Reputation: 489
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
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
Reputation: 4446
you can use that..
$(this).clone().appendTo("#edno").attr('selected',true);
hope its work
Upvotes: 1