-3

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!

user3637351
  • 11
  • 1
  • 5

1 Answers1

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.

aelor
  • 10,892
  • 3
  • 32
  • 48
  • Thanks man!! How would you put this within the section? – user3637351 Oct 07 '14 at 06:33
  • @user3637351 Sorry sir I dont understand your question, Do you mean how will we paste it inside script tags within head? – aelor Oct 07 '14 at 06:35
  • I want to load a script that I have external after the else statement and I want to put this in my tag – user3637351 Oct 07 '14 at 06:36
  • @user3637351 I think this can be useful to you : http://stackoverflow.com/questions/8586446/dynamically-load-external-javascript-file-and-wait-for-it-to-load-without-usi – aelor Oct 07 '14 at 06:47