How to reset a select element with jQuery How to reset a select element with jQuery jquery jquery

How to reset a select element with jQuery


Try this. This will work. $('#baba').prop('selectedIndex',0);

Check here http://jsfiddle.net/bibin_v/R4s3U/


In your case (and in most use cases I have seen), all you need is:

$("#baba").val("");

Demo.


$('#baba option:first').prop('selected',true);

Nowadays you best use .prop(): http://api.jquery.com/prop/