I am using alertify.confirm() in my spring mvc project.
alertify.confirm(
"Press OK to Confirm",
function(){ console.log("ok") },
function(){ console.log("canceled") });
But whenever i press OK or CANCEL button, it prints "ok" in the console. Why is this happening?
Alertify's
confirmhas four parameters, not three:title: string, message: string, onOK: function, onCancel: function )Change your code to this:
I do see an overload with 3 parameters in their documentation page, [however the source-code of Alertify's
confirm.js][2]re-uses theonokparameter foroncancel- I think that's a bug:Given that AlertifyJS hasn't been significantly updated in six years, I think you should consider using a different dialog library. Consider using native HTML5
<dialog>instead.