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

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -