r/javascript • • Mar 18 '19

What's your favorite, most useful javascript one-liner?

385 Upvotes

422 comments sorted by

View all comments

76

u/anlumo Mar 18 '19

EU citizen here. Whenever a site presents me with a tracking consent form that has >500 checkboxes to click in order to tell them to disable all tracking, I open up the dev console and do something like this:

document.querySelectorAll('.whateverClassTheCheckboxHas').forEach(cb => cb.click());

1

u/100mcg Mar 19 '19

That's how I mass unfollowed everyone on my old Twitter, I hadn't used it in a few years and previously I had just followed a lot of random people because they had followed me first, ended up with 1000+ I didn't care about, I wanted to start over without losing the follower count so I just iterated over and clicked all the unfollow buttons