I have a html form with a select, button and an input element.
<form action="">
<button>innocent button</button>
<select multiple name="multiple">
<option selected value="a">A</option>
<option value="b">B</option>
</select>
<input style="width:300px" type="text" value="press here enter and look at the multiple select" name="" />
</form>
and some jquery javascript
$(document).ready(function(){
console.log('hi');
var $button = $('button');
$button.on('click',function(e){
$('select option').first().attr('selected',false);
e.preventDefault();
});
Demo: try it here: http://jsfiddle.net/3Rjdh/
On Chrome everything is okay. But on Firefox: If you press ENTER in the input field, the select element loses it's selected.
What is wrong with Firefox?