ahmed0saber

Clicks counter using jQuery in HTML JS

Jun 19th, 2021
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2.   <head>
  3.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  4.     <script>
  5.     let x=0;
  6.     function increase ()
  7.     {
  8.       $("span").text(++x);
  9.     }
  10.     </script>
  11.   </head>
  12.   <body>
  13.     <p>You clicked the button <span>0</span> times</p>
  14.     <button onclick="increase()">Click</button>
  15.   </body>
  16. </html>
Advertisement
Add Comment
Please, Sign In to add comment