title: Simulate click on one element with JS or Jquery when clicking a different element
body: <p>I want one item to be clicked when I click on a different one, but I keep seeing these complicated answers that, frankly, don't make any sense. I feel like it should be easy as this, but this doesn't work.</p>
  <pre><code>&lt;div class=&quot;myElement&quot; onclick=&quot;myFunction()&quot;&gt;&lt;/div&gt;
  &lt;a href=&quot;https://example.com&quot; class=&quot;myElement2&quot;&gt;&lt;/a&gt;
  </code></pre>
  <pre><code>function myFunction() {
    document.getElementsByClassName('myElement2').click();
  }
  </code></pre>