I am new to the program! I want to implement a function, click the button to copy the URL in the onclick to the clipboard for the user to paste it elsewhere, but I don't know how to implement this requirement, I really need everyone's help ,thank you all.
function copyJoblink(joblink){
let joblink = "https://chickpt.com.tw/dl?tp=4&um=1&ti={{$formatted_job['id']}}&e=share_job"
window.getSelection().selectAllChildren(joblink);
document.execCommand('copy')
}
a{
display: block;
width: 60px;
height: 60px;
background-color: #ccc;
line-height: 60px;
text-align:center;
}
<a href="javascript:;" class="job_info_share_paperlink" onclick="copyJoblink('https://chickpt.com.tw/dl?tp=4&um=1&ti={{$formatted_job['id']}}&e=share_job')">copy</a>