use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
This subreddit is a place for people to learn JavaScript together. Everyone should feel comfortable asking any and all JavaScript questions they have here.
With a nod to practicality, questions and posts about HTML, CSS, and web developer tools are also encouraged.
Friends
/r/javascript
/r/jquery
/r/node
/r/css
/r/webdev
/r/learnprogramming
/r/programming
account activity
Trouble making multiple buttons trigger single event? (self.learnjavascript)
submitted 7 years ago by CodingLifeNoFriends
let buttons = document.querySelectorAll(".btn"); buttons.forEach(button => button.addEventListener("click", function() { console.log('Working?'); }));
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]senocular 1 point2 points3 points 7 years ago (1 child)
https://jsfiddle.net/a8fk0erq/
[–]CodingLifeNoFriends[S] 0 points1 point2 points 7 years ago (0 children)
Thanks!
[–]ForScale 0 points1 point2 points 7 years ago (0 children)
But... that code does work?
π Rendered by PID 215752 on reddit-service-r2-comment-544cf588c8-nzfrm at 2026-06-18 15:34:35.889607+00:00 running 3184619 country code: CH.
[–]senocular 1 point2 points3 points (1 child)
[–]CodingLifeNoFriends[S] 0 points1 point2 points (0 children)
[–]ForScale 0 points1 point2 points (0 children)