title: JavaScript focus a particular element with div class, not div id declaration
body: <p>The following function can focus on an element with an id declaration:</p>
  <pre><code>function setFocus() { 
      document.getElementById(&quot;focus&quot;).focus(); 
  } 
  </code></pre>
  <p>But how can one focus on an element with a classname declaration. Use case would be previously in the code where the element we want to focus on is already stored from the dom (i.e., <code>const element = document.querySelectorAll('.a-class-name')[0</code>]) type of scenario?</p>