Sunday 15 March 2015

javascript - From js to script -



javascript - From js to script -

in recent post load javascript after 2 clicks on website asked javascript issue.

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

problem want have javascript within script tags in <head> script wont work, can help me through how write script? thanks!!

update:

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

please add together jquery library file.. <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> code related jquery without jquery library can not run code.

javascript

No comments:

Post a Comment