multi select - Use jQuery to check for number of options NOT selected in a multiselect -
i have multiselect has huge list , i'm not allowed have option says "all".
but in background still want check see if selected or not. saw/had snippet of code did before can't find it. remember doing checking see if number of options not selected equal 0, knew options selected.
i want check on 1 line if can:
$("#my-multiselect:not(:selected)").length === 0
but $("#my-multiselect:not(:selected)").length
returning 1 or 0 true or false imagine. using :not()
incorrectly? or else need exact count?
you missing space:
$("#my-multiselect :not(:selected)").length === 0
because want select options
inside #my-multiselect
element.
Comments
Post a Comment