Using $.length() to check for presence of <li> not working
<p>I want to check if a list item already exists on the page before adding it.  My code below attempts to do this by checking the length of the ID for the list item.  However, no matter what my if statement always resolves to true.  Can someone tell me what the problem is?</p>

<pre><code>function addSpotsToMarketTree(dmaName, spot) {
    var id = "#" + dmaName + "-spots";
    var liID = "#" + spot + "-" + dmaName;
    if ($(liID).length == 0) {
        $(id).append("&lt;li id='" + liID + "'&gt;" + spot + "&lt;/li&gt;");
    }
}
</code></pre>
