Hey, I'm having a difficult time finding some good documentation for how to create a listener for a button onclick.
Had an in-line function call in my button at first, but obviously that failed out because it's not allowed for chrome extensions.
So I'm trying to create a listener, but I'm not sure how this syntax is supposed to look.
For context, the html document is an internal page that I'm pulling up with my chrome (browser) action.
in my html page:
<script src='serviceWorker.js'> </script>
<button class='button button1' id='button 1'><b> Instructions</b></button>
//trying to refer to this button by its id, but I can change that
in my service worker js:
document.getElementById('button 1').addEventListener('click', myFunction('Instructions'));
function myFunction(div id){
console.log('makes div invisible');
document.getElementById(div id).style.display = 'none';
return;
};
All I know is that this isn't really close.
Thanks for your help!