in JS, I have a variable
var text = "this is a test";
and when I click a button in my HTML, it calls a JS funciton
function nameoffunction(){
}
I want to copy to the clipboard "this is a test" when the function is called.
How can I do that ?