jQuery selectors: multiselect vs select
The correct attribute name for a <select>
element with multiple selectable options is multiple. You can use the "has attribute" selector to select elements with the multiple attribute, and combine it with :not() to select elements that only allow a single selection.
Therefore, your jQuery selector should be:
$("select#categories[multiple]") // <select> with multiple
$("select#categories:not([multiple])") // <select> with single only
http://www.w3.org/TR/html401/interact/forms.html#edef-OPTION