You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would say number 2 is better since getElementsByClassName is buggy. But I would also suggest that you avoid selecting things with descendant selectors as it's an anti pattern since it's under-performant.
e.g try and do document.querySelector('#id') or something similar instead of document.querySelector('#id .bar').
What is better way if use
$("#foo .bar")
?1 -
document.getElementById('foo').getElementsByClassName('bar')
?or
2 -
document.querySelector('#id .bar')
?The text was updated successfully, but these errors were encountered: