I have this code that scrapes the html of the website you are on and copies it to the clipboard. I currently have a working version that copies the text when you click the chrome icon, but I want to add several more options so I am trying to run the script on button click within the extension popup.
Unfortunately, I can not for the life of me manage to get something to happen on button click! When I replace my function with alert("hi"), it pops up the alert when I click on the extension icon rather than the button within the popup. Help!!!
document.addEventListener('DOMContentLoaded', function () {
document.getElementById("full_team").addEventListener('click', alert("HI"));;
});
<body>
<h2>Click to copy your roster</h2>
<button id="full_team">Full Team</button>
<script src="event.js"></script>
</body>