title: Does onclick Syntax for async arrow function work only with Id?
body: <p>This is part of my code. I just wanted to know why <code>document.getElementById("myName").onclick</code> works and <code>document.getElementByClassName("myClass").onclick</code> does not work in the following onclick arrow function example?</p>
  
  <p>Does <code>onclick</code> arrow function take document selector as ID by default or support only Id?</p>
  
  <p>What if i want to implement onclick to class in this case?
  <div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>//myName.onclick = async () =&gt; {   //even this representation works
  document.getElementById("myName").onclick = async () =&gt; {
   try {
      //some code here which call some async function (not related so not writing here) 
      alert('clicked.');
    } catch(e) {
     log(e);
    }
  };</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  &lt;button id="myName" class="myClass"&gt;&lt;strong&gt;Click me&lt;/strong&gt;&lt;/button&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>