Skip to content

Instantly share code, notes, and snippets.

@jonsamp
Last active June 4, 2017 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jonsamp/f38c5e158940255d31088fca9b7a87a5 to your computer and use it in GitHub Desktop.
Save jonsamp/f38c5e158940255d31088fca9b7a87a5 to your computer and use it in GitHub Desktop.
JavaScript Tips Tab: onTipButtonClick II
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