javascript - how to stop firing an event using java script -
i have "onclick" event , "onclientclick" event. "onclientclickevent" javascript function , "onclick event" runs on server. want way prevent firing on click event javascript function.scenario that-
asp:button id="button1" runat="server" text="submit" onclick="button1_click" onclientclick="javascript:anscheck()" />
you can this:
<asp:button id="button1" runat="server" text="submit" onclick="button1_click" onclientclick="javascript:return anscheck()" />
javascript
funcion anscheck(){ //based on code , condition can return if(condition){ return true // fire server side event } else{ return false; // not fire server event } }
or
<asp:button id="button1" runat="server" text="submit" onclick="button1_click" onclientclick="javascript:return anscheck() return false;" />
Comments
Post a Comment