I am trying to copy text from a HTML textarea, however I only found a solution with an Input tag like this:
<input type="text" value="User input Text to copy" #userinput>
<button (click)="copyInputMessage(userinput)" value="click to copy">Copy from Textbox</button>
Function:
copyInputMessage(inputElement){
inputElement.select();
document.execCommand('copy');
inputElement.setSelectionRange(0, 0);
}
When I want to replace the input tag with a textarea tag it doesn’t work anymore. Is there an similar easy solution with a textarea?