Reputation: 182
I have multiple span tags. example:
<span class="name one"></span>
<span class="name two"></span>
<span class="name three"></span>
<span class="name four"></span>
how can i remove second class without using class name like span.classList.remove('three'); i just need something like span.classList.remove(1); to remove only second class from all span elements
Upvotes: 3
Views: 757
Reputation: 182
I found answer
span.classList.remove(span.classList.item(1));
Upvotes: 2