Advertisement
lylythechosenone

Untitled

May 7th, 2020
1,317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* JS DOM: How can I select all elements with one class or another. I need to select elements with the class ad, and elements with the class adsbygoogle, but I want to select an element with just one of those, not both.BTW, this is a chrome extension, so no jQuery. I would also like to be able to add more classes later. Here is the code: */
  2.  
  3. window.onload = function() {
  4.     //theoretical starts here
  5.     var ads = document.getElementsByClassName('ad' or 'adsbygoogle');
  6.     //theoretical ends here
  7.     while(ads[0]) {
  8.         ads[0].parentNode.removeChild(ads[0]);
  9.     }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement