This function should work for all types of select (multiple, select, select2):
$.fn.Reset_List_To_Default_Value = function()
{
$.each($(this), function(index, el) {
var Founded = false;
$(this).find('option').each(function(i, opt) {
if(opt.defaultSelected){
opt.selected = true;
Founded = true;
}
});
if(!Founded)
{
if($(this).attr('multiple'))
{
$(this).val([]);
}
else
{
$(this).val("");
}
}
$(this).trigger('change');
});
}
To use it just call:
$('select').Reset_List_To_Default_Value();
This works a little differently from other answers in that it unselects all options:
$("#baba option").prop("selected", false);
(Borrowed from https://stackoverflow.com/a/11098981/1048376)
$('#baba option:first').prop('selected',true);
Nowadays you best use .prop(): http://api.jquery.com/prop/
Try this. This will work. $('#baba').prop('selectedIndex',0);
Check here http://jsfiddle.net/bibin_v/R4s3U/
$('#baba option:first').attr('selected',true);
If you want to reset by id
$('select[id="baba"]').empty();
If you want to reset by name
$('select[name="baba"]').empty();