//There is a lot to cover in this. The following link should help :) //In jQuery: $element.toggleClass(class-name) //In JavaScript: element.classList.toggle(class-name) https://www.geeksforgeeks.org/how-to-convert-jquery-to-javascript/