What is a safe way to check that a listbox is empty in JQuery?
<p>What is a safe way to check that a listbox is empty in JQuery ? Alternative question, how to check if there is no item actively selected ?</p>

<p>I have tried :</p>

<pre><code>if(...  .val() != "null")
</code></pre>

<p>also </p>

<pre><code>if(...  .val() != null)
</code></pre>

<p>as I spotted <code>null</code> value on <code>val()</code> while debugging when the list is empty or nothing is selected, but doesn't seem to work accurately.</p>
