Advertisement
brandblox

WebLab-3.1-(15/10/24)

Oct 15th, 2024 (edited)
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.77 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>
  5.         How to attach a click and double-click
  6.         event to an element in jQuery?
  7.     </title>
  8.  
  9.     <script src=
  10. "https://code.jquery.com/jquery-3.6.0.min.js">
  11.     </script>
  12.  
  13.     <script>
  14.         $(document).ready(function () {
  15.             $(".clickable_ele").bind("click", function () {
  16.                 $("<h4>Single click Event called</h4>")
  17.                 .appendTo(".res");
  18.             });
  19.  
  20.             $(".clickable_ele").bind("dblclick", function () {
  21.                 $("<h4>Double click Event called</h4>")
  22.                 .appendTo(".res");
  23.             });
  24.         });
  25.     </script>
  26.  
  27.     <style>
  28.         body {
  29.             text-align: center;
  30.         }
  31.         .clickable_ele {
  32.             font-size: 20px;
  33.             font-weight: bold;
  34.         }
  35.     </style>
  36. </head>
  37.  
  38. <body>
  39.  
  40.     <div class="clickable_ele">
  41.         Click here
  42.     </div>
  43.  
  44.     <div class="res"></div>
  45. </body>
  46. </html>
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement