Ok here is how you can select text to clipboard, You should have a input field with text init like this
<input type="text" id="generatedPassword" class="form-control" value="some text for copying">
Create a button and on click of that run function
<span id="clipBoard" onclick="copyContent()"> <i class="far fa-copy" aria-hidden="true"></i> Copy Text to Clipboard </span>
Function should have code something like this
function copyContent(){ // Get input field id from where you copy text let copyText = document.getElementById("generatedPassword"); // select function for coping copyText.select(); copyText.setSelectionRange(0, 99999); // exec command copy document.execCommand("copy"); }
That's it all done