Last active
June 4, 2017 21:08
-
-
Save jonsamp/f38c5e158940255d31088fca9b7a87a5 to your computer and use it in GitHub Desktop.
JavaScript Tips Tab: onTipButtonClick II
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
function onTipButtonClick() { | |
var tipButton = document.querySelector('.tip-button'); | |
tipButton.addEventListener('click', function() { | |
tipLimit = tipLimit - 1; | |
if (tipLimit >= 0) { | |
generateTip(); | |
if (tipLimit === 0) { | |
tipButton.innerHTML = 'See you in another tab!'; | |
tipButton.classList.add('disabled'); | |
} | |
} | |
}); | |
} | |
onTipButtonClick(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment