jquery - Copy to clipboard using javascript programatically (testing) -


i've got script deals pasted text in text area. write tests it. first step copy text in clipboard after reading lot topic ended this:

  1. add text area dom text want copy.
  2. add button dom runs document.execcommant("copy") on click.
  3. remove text area & button dom.

please take account before marking question duplicate, other solutions i've seen involve user performing click action. asking how strictly programmatically.

document.execcommant("copy") not work if it's not triggered user action due security reasons. in case, tests clicking on button, document.execcommant("copy") won't work.

is there way of doing without using new libraries? (jquery fine).

i interested in solution works on chrome/firefox.

here can see fiddle step mentioned above: https://jsfiddle.net/7b40ma0q/


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -