I am think this should be fairly easy, but struggling a bit ... I have a SELECT
input element that allows the user to select multiple items. I would like to pro
Maybe
$('#mySelect option').each(function(i, e)
{
e.selected = false
});
i try something like
$("#my-Select").find('option').attr("selected","") ;
In the case of a <select multiple>
the .val() function takes/returns an array, so you can simply pass in an empty array to clear the selection, like this:
$("#selectID").val([]);
You can test it out here.
Try this
<select id='select1' ></select>
<input type= 'button' value = 'Clear Selection' id = 'remove' />
$(document).ready(function() {
$('#remove').click(function() {
return $('#select1 option:selected').remove();
});
});