queryselectorall will not work as expected on a closed img alt

The " used to delimit the value in the attribute selector are clashing with the " used to delimit the JS string literal.

 document.querySelectorAll("img.pi[alt="Awaiting image"]");
                           ^           ^^
                           |           |Error
                           |           End of string
                           Start of string

Use a different kind of quote.

 document.querySelectorAll('img.pi[alt="Awaiting image"]');

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top