For dynamic state always use properties. Attributes are for the DOM, not for the live display. Older versions of jQuery used to cover this common mistake by setting the property in addition to the attribute when setting the attribute, but this has all sorts of nasty side-effects. Use prop('selected', value) instead for this, and pass it a boolean true/false value (so not "" or "selected").
Version: unspecified
Severity: major