I am trying to find if a class name exists in a webpage, and then add a new class.
Testing in Chrome Developer Tools Console I get undefined. What am I doing wrong?
Code I am using.
const srtClass = document.querySelectorAll('.sr-only');
srtClass.className += " showoffScreenText";
console.log(srtClass);
The results for the console.log
HTMLCollection(2) [span.sr-only, div.sr-only] className: "undefined showoffScreenText"
The sr-only class is found so why is it undefined?