Answers for "how to avoid duplicate values in dropdownlist using jquery"

0

how to avoid duplicate values in dropdownlist using jquery

$(".select option").val(function(idx, val) {
  $(this).siblings('[value="'+ val +'"]').remove();
});
Posted by: Guest on June-09-2021
0

how to avoid duplicate values in dropdownlist using jquery

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<select class="select">
  <option value="">All</option>
  <option value="com">.com 1</option>
  <option value="net">.net 1</option>
  <option value="com">.com 2</option> <!-- will be removed since value is duplicate -->
  <option value="net">.net 2</option> <!-- will be removed since value is duplicate -->
</select>
Posted by: Guest on June-09-2021

Code answers related to "how to avoid duplicate values in dropdownlist using jquery"

Code answers related to "Javascript"

Browse Popular Code Answers by Language