I am trying to find in my DOM all elements img
with a class 2x
using Vanilla JS. I use the method querySelectorAll
as follows:
document.querySelectorAll('img.2x');
But it throws this error in the console log:
Uncaught DOMException: Failed to execute 'querySelectorAll' on 'Document':
'img.2x' is not a valid selector.
Why is img.2x
not a valid selector? Thanks.
source
share