javascript split, each, check if exists in select if not add option
<p>Can anyone see what im doing wrong here?</p>

<p>I am trying to split <code>tag_filter</code>, then for each of the <code>tag_filter</code> values, I would like to check if the option value already exists in <code>tag_select_dropdown_filter</code>. If it does not exist then add option to <code>tag_select_dropdown_filter</code>.</p>

<pre><code>var tag_filter = new1,new2,new3;
var arraylist = tag_filter.Split(",");

jQuery.each(arraylist, function(index, item) {

   if ($('select#tag_select_dropdown_filter option[value="'+item+'"]').length) {
     // it exists
   } else { var o = new Option("option text", item);
     $(o).html("option text");
     $("#tag_select_dropdown_filter").append(o);
   }

});
</code></pre>
