The first one, I can use document.getElementById to get the object, but on some websites, like the second, there is no id in element, but I also want to get the object with class name and add other class. How can I do this ? And do not use JQuery, Need If one class exist add other class to other element
if (document.getElementsByClassName('class7') !== null) {
document.querySelectorAll('class2 class4').className += " classtobeadded";
}