JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <title>Test case for set/reset attribute issue</title>
    </head>
    <body>
        <select multiple="multiple">
            <option id="opt1">Choice 1</option>
            <option id="opt2">Choice 2</option>
        </select>
        
    </body>
</html>

JavaScript

// opt1 will be: selected (once)
// opt2 will be: selected, deselected, selected.
// At the end both should be selected.
// With Firefox 18.0.2, opt2 is NOT selected after being deselected.
var opt1 = $('#opt1');
var opt2 = $('#opt2');
opt1.attr('selected','selected');

opt2.attr('selected','selected')
opt2.removeAttr('selected')
opt2.attr('selected','selected');