title: How to use if else statement in JQuery to execute respective __doPostBack statement
body: <p>i want that same JQuery function should execute for two controls. How to use <code>if else statement based on class name selector in JQuery</code> that will decide that which control has trigger it so that either <code>__doPostBack('&lt;%=checkbox1.UniqueID%&gt;', &quot;&quot;)</code> or <code>__doPostBack('&lt;%=checkbox2.UniqueID%&gt;', &quot;&quot;)</code> should execute.</p>
  <p>I have used following statements but nothing happen although <code>JQuery</code> runs for each <code>chechbox</code></p>
  <pre><code>if ((chk).hasClass('ab1'))
       __doPostBack('&lt;%=checkbox1.UniqueID%&gt;', &quot;&quot;);
   else
       __doPostBack('&lt;%=checkbox2.UniqueID%&gt;', &quot;&quot;);
  </code></pre>
  <p>here <code>chk</code> is the respective <code>checkbox</code> that called <code>JQuery</code> function</p>
  <p><strong>Edited</strong></p>
  <p>checkbox click function</p>
  <pre><code>OnClick=&quot;return shakeel(this);&quot;  
  </code></pre>
  <p>Following register the two checkboxes</p>
  <pre><code>&lt;script&gt;
      function shakeel(chk) {
          $(function () {
              $('.ab1, .ab2').on('click', DiscountAtLast(chk));
              });         
          return true;
      }
  &lt;/script&gt;
   
  </code></pre>