Remove duplicate elements from list by value with jQuery

jQuery is very useful and easy to learn and it’s very, very powerful. If you look at the code below you’ll see that with a few lines of code we are able to remove duplicate content from the list.

Here is my HTML

<ul >
  <li value="1" name="test" id="test1">test 1<li>
  <li value="1" name="test" id="test3">test 3<li>
  <li value="1" name="test" id="test3">test 3<li>
  <li value="3" name="test" id="test4">test 4<li>
  <li value="4" name="test" id="another1">another 1<li>
  <li value="5" name="test" id="another1">another 2<li>
   <li value="5" name="test" id="another1">another 2<li>
  <li value="4" name="test" id="another3">another 3<li>
</ul>

Here is my CSS

.list {
  
  list-style:none;
}

Here is jQuery

$(document).ready(function(){
  var found = {};
  $('li').each(function(){
    var $this = $(this);
    if(found[$this.attr('value')]){
      $this.remove();
    }else{
      found[$this.attr('value')] = true;
    }
  });
});

You can also read this

Routing in Node.js with Express.Js

In this post I will try to explain how routing...

app.get('/', function (req, res) {
  res.send('hello from me')
})

Responsive CSS counter without Javascript

CSS counters let you adjust the appearance of content based on...

@media (max-width: 319px) {
    .small-card__item:nth-child(1)~.small-card__item {
        counter-increment: item-count;
    }
}