I have a drop down menu of choice. I add parameter values dynamically from the backend, but when the same values arrive, there are duplicates in the drop-down list. I want to have only unique values in the drop-down list. How to check if an existing value exists before adding it to the drop-down list?
I add a value something like this:
$("#pid").append('<option value="'+strSplit[0]+'"selected="">'+strSplit[0]+'</option>'); $("#pid").selectpicker("refresh");
source share