title: How to disable and then re-enable onclick event in <img> using jquery
body: <p>I have used an image instead of button, now I want to disable the <code>onclick()</code> event in some case as we disable a button. I tried many ways but doesn't work. Below is what I did:</p>
  <pre><code>&lt;img title=&quot;Ok&quot; class=&quot;mtbtn&quot;id=&quot;upd_1&quot; onclick=&quot;add_edited('1','MM');&quot; src=&quot;/project/images/green_ok.gif&quot; border=&quot;0&quot;&gt;
  </code></pre>
  <p>The jQuery code is:</p>
  <pre><code>$(&quot;#upd_1&quot;).css('opacity','0.5');
  $(&quot;#upd_1&quot;).unbind(&quot;click&quot;);
  </code></pre>
  <p>I also tried:</p>
  <p><code>$(&quot;#upd_1&quot;).css('pointer-events','none');</code> and <code>document.getElementById('upd_1').style.pointerEvents = 'none';</code>.</p>
  <p>Any solution?</p>