Better way to query and pass the elements to conditional operator in Javascript
Interesting question;

You can make this code slightly less efficient (however, the user will never notice), and so we can just attach listeners to everything.

const addClickEventListeners = () =&gt; {

  const addListener = (button) =&gt; button.addEventListener('click', someFunction, false);

  document.querySelectorAll('[name="multiple_choice"]').forEach(addListener);
  document.querySelectorAll('[name="true_false"]').forEach(addListener); 
  document.querySelectorAll('[name="multi_answers"]').forEach(addListener); 

};


This should behave the same way as far as I can tell.

You could also create your buttons that require someFunction with a css class dedicated for that selection or even better with a data attribute for that purpose. Then you just query on that and attach the listener.