Count the number of selected items in multiselect listbox using javascript
<p>I need to get the count of selected items in multi select listbox, tried below but couldnt make it work.</p>

<pre><code> var selItem = document.getElementById("users").options; 
        if(selItem.selected == 0){
        alert('select item');
        }
</code></pre>

<p>here i tried to give alert if there is no item selected, but not working</p>

<pre><code>if (document.getElementById('usersb').options:selected.length == 0){
 alert('select item');
 }
</code></pre>

<p>Can anyone give an idea, how can i do that.</p>