S
S
sweet12322021-07-07 22:41:26
JavaScript
sweet1232, 2021-07-07 22:41:26

The code doesn't work. why?

let el = document.querySelectorALL('.thumb li');
    for (let i = 0; i < el.length; i++){
      el[i].onclick = function(){
        var c = 0;
        while (c < el.length){
          el[c++].className = 'check';
        }
        el[i].className = 'check active';
      }
    }


Code not working, can't figure out why, please help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dima Pautov, 2021-07-07
@sweet1232

querySelector ALL > querySelector All

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question