jquery remove duplicate elements
2020. 8. 11. 17:50ㆍJavaScript/JQuery
728x90
https://stackoverflow.com/questions/48579723/jquery-to-remove-duplicate-elements-from-list-by-value
$(document).ready(function(){
var found = {};
$('li').each(function(){
var $this = $(this);
if(found[$this.attr('value')]){
$this.remove();
}else{
found[$this.attr('value')] = true;
}
});
});
728x90
반응형
'JavaScript > JQuery' 카테고리의 다른 글
PHP ajax force_download only shows in browser (0) | 2021.01.13 |
---|---|
jquery append, after 차이 (0) | 2020.08.31 |
event binding on dynamically created elements (0) | 2020.08.12 |
JQuery event.preventDefault() 용도 (0) | 2020.08.12 |
JQuery .show() vs .css('display', 'block) (0) | 2020.07.13 |