Onclick Confirm Not working

后端 未结 2 1754
感动是毒
感动是毒 2021-01-23 22:02

Hello I have this line of code.

onClick=\"confirm(\'Are you sure you want to update the database
   to the latest version?\')\">
  • Updat
  • 相关标签:
    2条回答
    • 2021-01-23 22:33

      You must use return confirm(...) instead of just confirm(...) for it to work.

      0 讨论(0)
    • 2021-01-23 22:34

      Confirm function actually returns a boolean. It's true if the user clicks ok, and false if cancel is clicked.
      So you need to save the return value of confirm function in a variable, and then check that variable to perform desired operations.

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