Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to avoid duplicate values in dropdownlist using jquery

$(".select option").val(function(idx, val) {
  $(this).siblings('[value="'+ val +'"]').remove();
});
Comment

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>
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript initialize two array in one line 
Javascript :: discord js if no arguments 
Javascript :: electron js production release Distributing 
Javascript :: axios post method 
Javascript :: mongoose updatemany example 
Javascript :: UnhandledPromiseRejectionWarning: TypeError: Converting circular structure to JSON 
Javascript :: javascript date array 
Javascript :: window onload 
Javascript :: animate change of class angular 
Javascript :: require express server.js 
Javascript :: return inside ternary operator javascript 
Javascript :: prevent form submit html javascript jquery 
Javascript :: change events 
Javascript :: nested ternarys javascript 
Javascript :: math js 
Javascript :: react build size 
Javascript :: js regex find 
Javascript :: @angular-devkit/build-angular <error 
Javascript :: Javascript using forEach loop to loop through an array 
Javascript :: insert isValidPhoneNumber in react hook form 
Javascript :: vue style 
Javascript :: javascript is array or object 
Javascript :: see if array contains array javascript 
Javascript :: javascript htmlcollection 
Javascript :: mong db connect error 
Javascript :: stop python script nodejs 
Javascript :: javascript find factorial 
Javascript :: how to upload file with button react 
Javascript :: discord.js buttons 
Javascript :: vanilla js append new element 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =