how to remove a parent class element using js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to remove a parent class element using js

ive been trying to remove a parent class element so i can replace it with a new parent class with diffrent class id but i cant get it to work right i understand mostly how to remove a child element from a parent element but sadly the lesson doesnt tell you how to remove what im needing

18th Aug 2018, 5:31 PM
Wilde Night
Wilde Night - avatar
5 Answers
+ 2
use element.parentNode.classList.remove("class-name"); https://code.sololearn.com/WbBEAW3F07D5/?ref=app
19th Aug 2018, 12:22 AM
Calviղ
Calviղ - avatar
0
8down voteaccepted this.parent().removeClass("playing"); $(this).closest('div').removeClass("playing")
18th Aug 2018, 6:23 PM
Mayur Shedage
Mayur Shedage - avatar
0
you did this with qjuery right i need it to be in pure javascript
18th Aug 2018, 6:41 PM
Wilde Night
Wilde Night - avatar
0
it just clicked for me thank you
18th Aug 2018, 7:22 PM
Wilde Night
Wilde Night - avatar