Report Bug

QusWhich method is used to toggle a class on an element? Qusकिसी तत्व पर कक्षा को टॉगल करने के लिए किस विधि का उपयोग किया जाता है?


A. classList.add()
B. classList.remove()
C. classList.toggle()
D. classList.replace()


Solution
C. classList.toggle()



Explanation
The toggle() method of the classList property adds a class if it doesn't exist and removes it if it does. This is useful for switching between states (e.g., light/dark themes).
Latest Current Affairs 2026 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad