JQuery - determine if ALL multiple select box items are selected?

What is the easiest way to determine if ALL items in a multiple HTML select box are selected?

-------------Problems Reply------------

You can check the .length of :not() :selected <option> elements, for example:

var allSelected = $("#selectID option:not(:selected)").length == 0;

check if the number of not selected is zero and if there are at least 1 option

var all = $("select :not(:selected)").length == 0 && $("select options").length > 0;

Category:jquery Views:0 Time:2010-11-29
Tags: jquery

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.098 (s). 11 q(s)