title: copy whole html table to clipboard javascript
body: <p>I have write javascript to select the table but I want to now automaticaly copy it after the click of the button.Please help me.My javascript is like this.</p>
  
  <pre><code>function selectElementContents(el) {
              var body = document.body, range, sel;
              if (document.createRange &amp;&amp; window.getSelection) {
                  range = document.createRange();
                  sel = window.getSelection();
                  sel.removeAllRanges();
                  try {
                      range.selectNodeContents(el);
                      sel.addRange(range);
                      document.execCommand('Copy');
                  } catch (e) {
                      range.selectNode(el);
                      sel.addRange(range);
                      document.execCommand('Copy');
                  }
              } else if (body.createTextRange) {
                  range = body.createTextRange();
                  range.moveToElementText(el);
                  range.select();
                  range.execCommand('Copy');
  
              }
          }
  </code></pre>