JSFiddle - React, Tailwind, and code Playground
HTML
<select>
<option value='p'>p</option>
<option value='q' selected>q</option>
<option value='r'>r</option>
<option value='s'>s</option>
</select>
<input type='button' value='click me!'/> <br/>
ResultA : <span id='ResultA'>
here
</span> <br/>
ResultB : <span id='ResultB'>
here
</span> <br/>
JavaScript
function SetResult(ResultObj, ElementObj) {
ResultObj.text("length=" + ElementObj.length + " " + "val()=" + ElementObj.val());
}
$(function() {
$('input[type=button]').click(function() {
var SelectObj = $('select');
// The following 2 CSS selectors are expected to give the same results, but they don't.
SetResult($("#ResultA"), SelectObj.find('option[selected]'));
SetResult($("#ResultB"), SelectObj.find('option').filter('[selected]'));
});
});