Delete duplicate entries from a select box

前端 未结 4 1496
梦谈多话
梦谈多话 2021-01-05 17:18

How would I, using jQuery, remove the dups

        
        
4条回答
  •  执笔经年
    2021-01-05 17:55

    Try use below code to remove duplicate options:

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

提交回复
热议问题