How to get not clicked elements | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

How to get not clicked elements

When I click on an element I want apply some event on all elements exept on clicked element. Please tell if anyone know

14th Nov 2022, 2:06 PM
vivek rai
vivek rai - avatar
1 Antwort
+ 1
If you use similar elements(with the same class or tag), you can make a function that loops through everything, making the change that you need(background color for example), then after the loop is done, you can use something like this: this.style.background="red" Then you will have all the elements changed, and the one you clicked changed back
14th Nov 2022, 2:30 PM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar