Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* 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: */
- window.onload = function() {
- //theoretical starts here
- var ads = document.getElementsByClassName('ad' or 'adsbygoogle');
- //theoretical ends here
- while(ads[0]) {
- ads[0].parentNode.removeChild(ads[0]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement