Confirmation on submit

后端 未结 1 1944
無奈伤痛
無奈伤痛 2020-12-11 21:53

I have a form that submits information to a database. How can I make it so that when I click the submit button, I get an alert that asks me if I really want to submit it and

1条回答
  •  庸人自扰
    2020-12-11 22:09

    Use JavaScript confirm() function.

    
    

    If the user chooses Yes, it will return true and the button's default action (submitting the form) will continue as usual. But if the user chooses No, it will return false and the button's default action will be blocked.

    0 讨论(0)
提交回复
热议问题