How to add Confitm the button?

Good evening!)

How to implement button with confirmation ?

<button onclick="confirm('Post will of been deleted! Are you sure ?')">Delete</button>


When you press the cancel button, it works as OK.

How to solve the problem ?

Thank you!
June 5th 19 at 21:41
2 answers
June 5th 19 at 21:43
Solution
return confirm()
June 5th 19 at 21:45
Solution
<button onclick="return confirm('Post will of been deleted! Are you sure ?')">Delete</button>

Find more questions by tags JavaScript