title: I cannot select and copy onclick event "span element" in javaScript
body: <p><code>select()</code> function is working with input tag but not with span tag. How to solve it?</p>
  
  <pre><code>&lt;span id="selector"&gt;paragraph&lt;span&gt;
  &lt;script&gt;
    document.getElementById("selector").addEventListner("click", 
    myFunction);
  
  function myFunction(){
    var selectItem = document.getElementById("selector");
    selectItem.select();
    document.execCommand("copy");
  
    };
   &lt;/script&gt;
  </code></pre>