Copy to Clipboard using pure Javascript

Table of contents

Here is the code for copy to clipboard using pure javascript you can use this code on your project for copy something.

Code

function Copy(){
        var copyText=document.getElementById("textbox");
        copyText.select();
        copyText.setSelectionRange(0, 999);
        document.execCommand("copy");
        alert("Copied");
    }

Using this code you can copy the content of textbox in webpage.