Form confirmation on submit

后端 未结 5 1548
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-21 03:58

I want to have a confirmation from the user before they submit a form. This will prevent accidental POSTing of the form, that may be incomplete or incorrect.

Here is my

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-21 04:52

    Instead of returning 0 and 1, return true and false. You can actually shorten the function to:

    function confirm_update() {
        return confirm("Are you sure you want to submit?");
    }
    

提交回复
热议问题