Last active
September 28, 2020 17:32
-
-
Save amycruz97/af427a69dec50210572b0aabccb048f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// we created a myBtn function stating that when ever we click btn, it should alert 'you clicked on the button class' | |
function myBtn() { | |
alert('you clicked on the button class') | |
}; | |
// btn class does not exist in our html page therefore this will throw an error of addEventListener of null | |
const btn = document.querySelector(".btn").addEventListener('click',myBtn) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment