Disable postback at click on a button

后端 未结 10 563
名媛妹妹
名媛妹妹 2021-01-03 20:31

I want do disable postback after clicking a . I\'ve tried to do that by assigning onclick=\"return false\", but in the button doe

10条回答
  •  北荒
    北荒 (楼主)
    2021-01-03 21:23

    In my case none of the solutions above worked for me.

    What I wanted was to first call a function on the client side and then halt the postback to the server. My solution was to simply add the return keyword before calling my client-side function, i.e.:

    
    

    My client-side script contains return false in the last line of code.

提交回复
热议问题