Deselecting all elements from a multi-select dropdown in jQuery Deselecting all elements from a multi-select dropdown in jQuery jquery jquery

Deselecting all elements from a multi-select dropdown in jQuery


$("#edit-rec option:selected").removeAttr("selected");


Try -

$("#edit-rec > option").attr("selected",false);

Demo - http://jsfiddle.net/LhSBu/


On click of radio button you can use this

$("#edit-rec  option").each(function(){    this.selected=false;});