A pure JavaScript solution for copying the contents of a textarea to the clipboard when the user clicks on the textarea:
<script>
function copySelectionText(){
var copysuccess // var to check whether execCommand successfully executed
try{
copysuccess = document.execCommand("copy") // run command to copy selected text to clipboard
} catch(e){
copysuccess = false
}
return copysuccess
}
function copyfieldvalue(e, id){
var field = document.getElementById(id)
field.select()
var copysuccess = copySelectionText()
}
var bio = document.getElementById('mybio')
bio.addEventListener('mouseup', function(e){
copyfieldvalue(e, 'mybio')
var copysuccess = copySelectionText() // copy user selected text to clipboard
}, false)
</script>
Note: If you want to copy only parts of the textarea contents to clipboard, the tutorial Reading and copying selected text to clipboard using JavaScript has more info on that.