im making a function will clipboard each <span class="tag">Value</span> by className
When i tested it was fine on console but it's not copying anthing to clipboard, may i know the issue where exactly?
the code here
<script type="text/javascript">
document.getElementById("copy_hashtags").addEventListener("click", copytags);
function copytags() {
var tags = document.querySelectorAll('.tag');
var result = [];
for(var i = 0; i < tags.length; i++) {
result.push(tags[i].innerText);
}
result = result.join(' ');
copyToClipboard(result);
console.log(result);
}
</script>