7
For example:
- I have more than one
ul
with theirli
; - If I click on a
li
of the firstul
she has to add a class; - If I click on a
li
of the secondul
, she adds that same class. Only that does not interfere with the list of the firstul
;
To be more clear, it’s as if each ul
were a radio button group, where only one per group is marked.
Any idea?
Interesting. There are 3 satisfactory answers, but written in relatively different ways. I was curious about the following: which parameters could be used to define which is the best?
– iuristona
All answers really worked. I don’t know yet which one to vote on.
– Jefferson Alison
Makes a Jsperf and vote for the one with the best performance, after all probably will be the best algorithm.
– Gabriel Gartz
How does @Gabrielgartz work? I don’t quite understand.
– Jefferson Alison
I ran the tests for you Jefferson, I hope it helps: http://jsperf.com/alteradores-class
– Gabriel Gartz