The question is asked in a misleading manner. “Removing the selected attribute” and “deselecting all options” are entirely different things.
To deselect all options in a documented, cross-browser manner use either
$("select").val([]);
or
// Note the use of .prop instead of .attr
$("select option").prop("selected", false);