javascript - jquery return false not Working in Function called from onclientclick button event -


in aspx page have declared jquery function , called in button's onclientclick function return false not occuring in it

 <asp:button id="btnremove" text="remove" runat="server" causesvalidation="true" cssclass="submitbutton" onclientclick="checkconfirm();" onclick="btnremove_click" />  function checkconfirm() {             if ($("['txtservername']").val() != "") {                 var r = confirm("the selected server deleted database!!");                 if (r == true) {                     return true;                 }                 else {                     return false;                 }             }         } 

i new jquery. please let me know why return false not stopping hte event proceeding.

try this:

<asp:button id="btnremove" text="remove" runat="server" causesvalidation="true" cssclass="submitbutton" onclientclick="return checkconfirm();" onclick="btnremove_click" /> 

instead of

 <asp:button id="btnremove" text="remove" runat="server" causesvalidation="true" cssclass="submitbutton" onclientclick="checkconfirm();" onclick="btnremove_click" /> 

add return in onclientclick


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -