Skip to content Skip to sidebar Skip to footer

Load Javascript After 2 Clicks On Website

I have a javascript that I want to load when the user has clicked two times on my website. I have no clue how to this. Any suggestions? Thanks!

Solution 1:

$(function(){
  var count = 1
  $(document).click(function(){
    if(count<=2){
      count+=1;
    }
    else{
      alert("already clicked two times");
    }   
  });
})

this will start showing the alert after the 2nd click. You can write the code to load the javascript instead of this alert.


Post a Comment for "Load Javascript After 2 Clicks On Website"