function copy(){
var email = "abc@dfg.ca";
email.select();
document.execCommand("Copy");
};
The above code does not copy the email address.
Advertisement
Answer
Check the snippet, this may help you
function copyEmail(){
var email = document.getElementById('email');
email.select();
document.execCommand('copy')
};<input type="email" id="email"/> <input type="button" value="copy" onClick="copyEmail()"/>