title: copy text to clipboard by click on parent element
body: <p>I Want copy inner span text to Clipboard by click on parent element of it, my Html code is like this:</p>
  
  <pre><code>&lt;div&gt; &lt;span&gt; text to copy &lt;/span&gt; &lt;/div&gt;
  &lt;div&gt; &lt;span&gt; text to copy &lt;/span&gt; &lt;/div&gt;
  &lt;div&gt; &lt;span&gt; text to copy &lt;/span&gt; &lt;/div&gt;
  </code></pre>
  
  <p>and my Java Script code it is:</p>
  
  <p><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>const mySpan = document.querySelectorAll('span');
  
  mySpan.forEach(element =&gt; {
      var parSpan = element.parentElement;
      parSpan.addEventListener('click', () =&gt; {
          var elIn = element.innerHTML;
          document.execCommand('copy');
      });
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>i used of execCommand but its not copied to Clipboard , where is problem?</p>