check if specific li element exists in ul
<p>I've got a script that adds li elements to a ul and assigns some attributes to it based on a user's selection in a select element.  However, I figured it would be necessary to make sure that the li element doesn't already exist in the ul.  However, I'm not sure, but I think that either the array isn't assigning variables to it or there's something wrong with my if statement that compares the array.  Of course, I may be totally off.  I'm stumped.</p>

<pre><code>function anotherCounty(){    
  var newCounty = document.forms['newForm'].county.value;
  var ul = document.getElementById("counties"); 
  var items = ul.getElementsByTagName("li");
  var itemArray = new Array();
  for (var i = 0; i &lt; items.length; i++){
    itemArray.push(items[i]);
  }

  if (itemArray.indexOf(newCounty)&lt;'0'){//I've also tried ==-1 and &lt;0
    var new_item = document.createElement("li");
    new_item.id = "addCounty[]";
    new_item.innerHTML = newCounty;
    ul.insertBefore(new_item, ul.firstChild);
  }  
}
</code></pre>
