I've been having lots of issues trying to understand different methods on how to copy a text to the clipboard. I would really appreciate if someone can explain to me why my code isn't working.
<!DOCTYPE HTML>
<html dark= "true" style="font-size: 50px;font-family: Roboto, Arial, sans-serif">
<body>
<textarea id="copytext">ROGER</textarea>
<div class="button" id="adadad">
<button onclick="copyS()" id="dlld">
</button>
</div>
<p> </p>
<script type=text/javascript">
function copyS{
clicked = document.getElementById("dlld");
}
if ("dlld" == clicked){
var am1 = document.getElementById("copytext");
document.execCommand("copy");
}
}
</script>
<p> </p>
</body>
</html>