jquery copy to clipboard Edit

Murugan Andezuthu Dharmaratnam | 23 September 2020 | 818

There is no option to copy text directly to the clipboard. The sample code below will help to copy text to the clipboard.

Script

function copyToClipboard(text) {
       var $temp = $("<input>");
       $("body").append($temp);
       $temp.val(text).select();
       document.execCommand("copy");
       $temp.remove();
}
           
                    

you can pass the text as a parameter to the copyToClipboard function and the text will get copied to the clipboard.