javascript - Asp Radiobuttonlist causing postback even after returning false from js -
html:
<asp:radiobuttonlist id="rdstatus" runat="server" height="48px" repeatdirection="horizontal" autopostback="true" onselectedindexchanged="rdstatus_selectedindexchanged" cssclass="rad"> <asp:listitem text="active" value="1"></asp:listitem> <asp:listitem text="deactive" value="0"></asp:listitem> </asp:radiobuttonlist>
jquery:
$(".rad").click(function () { return confirm("do want change status?"); });
it causes postback irrespective of whether click ok or cancel in confirmation box.
<script type="text/javascript"> $(document).ready(function () { $(".rad").click(function () { var = confirm('do want change status?'); if (a==false) { return false; } else { return true; } }); }); </script>
Comments
Post a Comment