+ 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 ???

18th Apr 2020, 6:07 PM
Arushi Singhania
Arushi Singhania - avatar
2 ответов
18th Apr 2020, 8:54 PM
Abhay
Abhay - avatar
+ 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
19th Apr 2020, 6:56 AM
Yakobus Patrick
Yakobus Patrick - avatar