To bind a "Hello World!" alert box the dblclick event on every paragraph on the page: : dblclick « jQuery « JavaScript DHTML






To bind a "Hello World!" alert box the dblclick event on every paragraph on the page:

 



<html>
  <head>
    <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){


                var divdbl = $("div");
                divdbl.dblclick(function () { 
                  divdbl.toggleClass('dbl'); 
                });


        });
    </script>
<style>

  div.dbl { background:yellow;color:black; }
  
</style>
  </head>
  <body>
    <body>
         <div>asdf</div><span>Double click the block</span>
    </body>
</html>

   
  








Related examples in the same category