+ 3
Which is better to use queryselector or getElementById ??
If I just focus on TIME, it will take to execute the code, which of the two is better option to use OR are there different circumstances in which one can be better ???
2 ответов
+ 2
Maybe this will help you ,
https://gomakethings.com/javascript-selector-performance/
+ 1
if you want to get id it's better to use getElementById
also for class and tag, but if difficult to remember, example:
getElementById
getElementsByTagName
you need to remember E B I E s B T N
so i recomend if you make big project, use querySelectorAll