The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Learning JS Reply To: Learning JS


First and most importantly, how does the JS know to run when a button is clicked, there is no trigger in the HTML.

This line stores the target in the variable comments

var comments = document.getElementById('comments');

Then later,


Event listener is attached to listen to any clicks, then it just runs the replybox_onClick function.

Hope that helps,