3

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

1 Answer 1

2

I found answer

span.classList.remove(span.classList.item(1));
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.