jQuery: Binding event handlers to events

Click the flower...Left flower is bound to single click and right flower bound to double click.



The Code START

<script src="http://code.jquery.com/jquery-latest.js"></script>
  
    <script type="text/javascript">
      $(function() {
        $('#target').bind('click',function(event) {
            alert('Hello!');
          });
      });
      
      $(function() {
        $('#target2').bind('dblclick',function(event) {
            alert('Hey you clicked twice!');
          });
      });
    </script>
    
    <style type="text/CSS">
        <!--
        .code { color: red; }
        .back { background-color: yellow; }
        -->
   </style>
  </head>

  <body>
    <h1>jQuery: Binding event handlers to events</h1>
    <h1>Click the flower...</h1>
    <img id="target" src="Image1.jpg"/>
    <img id="target2" src="Image1.jpg"/>