(in vanilla JavaScript) I was wondering if there was an easy way to do something like
x = document.getElementsByTagName('span') && getElementsByClassName('null');
To return all 'span' elements that have class name 'null'?
I thought it could be something like:
x = document.getElementsByTagName('span'); x = x.getElementsByClassName('null'); // or x = document.getElementsByTagName('span').getElementsByClassName('null');
But that didn't seem to work.
Is this possible, or will I have to iterate over x, invoking everything that returns false for .class = 'null'?
Thanks.
source share