Skip to content

Instantly share code, notes, and snippets.

@J2TEAM
Created March 20, 2018 02:57
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 J2TEAM/e704cd069b8d86aed9c07e079cb8bac5 to your computer and use it in GitHub Desktop.
Save J2TEAM/e704cd069b8d86aed9c07e079cb8bac5 to your computer and use it in GitHub Desktop.
/* Developed by Juno_okyo */
function clickCount(c){var b=document.querySelector(c);if(null!==b){var a=b.dataset;void 0===a.clickCount?(a.clickCount=1,b.addEventListener("click",function(){clickCount(c)},!1)):(a.clickCount=parseInt(a.clickCount)+1,console.info("Clicked: "+a.clickCount))}}
// <button type="button" id="test">Click me</button>
// Call function: clickCount("#test");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment