My problem is removing duplicate parameter values. From the beginning, the option values ββare unknown. When I select a city, it processes the ajax request and receives all available ads from this city. From this "city array" a drop-down list with streets is automatically created. But, of course, these are duplicate parameter values. So how can I delete them?
<select name="det_pas_object_gatve" class="det_pas_object_select_css"> <option selected="selected" value="">--- Choose street ---</option> <option value="Barrow">Barrow</option> <option value="Hornets">Hornets</option> <option value="Barrow">Barrow</option> <option value="Stanley">Stanley</option> <option value="Simon">Simon</option> <option value="Barrow">Barrow</option> </select>
WORKERS:
var foundedinputs = []; $("select[name=det_pas_object_gatve] option").each(function() { if($.inArray(this.value, foundedinputs) != -1) $(this).remove(); foundedinputs.push(this.value); });
Vital source share