title: jquery onclick click event
body: <p>I have div which has an onlcick event. Now when i click the div i want to change its onlick function with .click attribute of jquery. I am able to change it dynamically, but when i apply it the new event also gets fired. Is there any work around so that the new is not fired but just applied to the div with new function?
  Here is what i am trying to do </p>
  
  <p>i have a div </p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
  function testMe(data)
  {
     alert(data);
     $('#testMe').unbind('click');
     $('#testMe').click(function(){ testMe('2');  });
  }
  
  &lt;/script&gt;
      &lt;div id='testMe' onclick='testMe(1)' &gt;click on me, I will disappear.&lt;/div&gt;
  </code></pre>
  
  <p>when I execute theabove code i still get value 1 om alert box 
  THANKS EveryOne    </p>
  
  <p>Also i tried the below code but it is not working for me </p>
  
  <pre><code> function testMe(data)
  {
     alert(data);
     $('#testMe').unbind('click');
     $('#testMe').click( testMe(2) );
  }
  </code></pre>
  
  <p>Though the code is updating the onlick event from 'testMe(1)' to 'testMe(2)' but it continuously alerts value 2. The work around this problem is traditional JS script code as:</p>
  
  <pre><code> document.getElementById('testMe').onclick =  testMe(2) ;
  </code></pre>
  
  <p>And its working without alerts.</p>