title: How can I copy <pre> tag code into clipboard in HTML?
body: <p>I'm trying to copy the code written inside a <code>&lt;pre&gt;</code> tag into the clipboard.
  How can I do that?
  I have tried to solve this problem using the code below:</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>function myFunction() {
    var copyText = document.getElementById("myInput");
    copyText.select();
    document.execCommand("Copy");
    alert("Copied the text: " + copyText.value);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;pre id="myInput"&gt;
    &lt;span style="color:#97EDDC;"&gt;class &lt;/span&gt;first
      {
          &lt;span style="color:#97EDDC;"&gt;public&lt;/span&gt; &lt;span style="color:#97EDDC;"&gt;static &lt;/span&gt; &lt;span style="color:#97EDDC;"&gt;void &lt;/span&gt; main(String args[]) // here S is capital of String word
          {
              System.out.println("Hello World!!"); // here S is capital of System word
          }
      }
  &lt;/pre&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>Give me the proper solution to copy code from pre tag into clipboard without including span tags.</p>