It may be duplicate question but i didnt find the solution for this.
I am trying to copy text on button click. Its working on chrome, mozilla(working on on windows a
I had the same problem - it turned out my issue was caused because I was creating a temporary select element to copy the text from, which is fine, but I was also hiding it via various methods, the culprit being element.style.width = 0. Removing that and using other methods to hide it solved my issue.
Hope this helps anyone running into the same problem.