title: Copy To Clipboard not working for generated content
body: <p>I have a Javascript function which generates dynamic content and I want to copy the generated address to clipboard but the code isn't working. When I manually run the function in console it works.</p>
  <p>I have tried defining the variable in the generated content itself with a script tag but that didn't work either.</p>
  <p>My Code</p>
  <pre><code>$(&quot;#crypto-container&quot;).append(`
                      &lt;div class=&quot;card address-card&quot;&gt;
                      &lt;div class=&quot;crypto-address-text&quot; id=&quot;clipboard_address&quot;&gt;${crypto_address}&lt;/div&gt;
                      &lt;img src=&quot;assets/img/copy-icon.svg&quot; class=&quot;copy-icon&quot;&gt;
                   
                       &lt;div class=&quot;card-copy-success&quot; style=&quot;opacity: 0;&quot;&gt;
                           &lt;span&gt;Copied! &lt;img class=&quot;copy-check-icon&quot; src=&quot;assets/img/copied-check.svg&quot;&gt;&lt;/span&gt;
                       &lt;/div&gt;
                   &lt;/div&gt;
   `);
  
    $(document).on(&quot;click&quot;, &quot;div.address-card&quot;, function () {
      copyToClipboard('#clipboard_address');
    });
    
    function copyToClipboard(element) {
      var $temp = $(&quot;&lt;input&gt;&quot;);
      $(&quot;body&quot;).append($temp);
      $temp.val($(element).text()).select();
      document.execCommand(&quot;copy&quot;);
      $temp.remove();
    }
  
  
  </code></pre>