提交表单时显示错误警报


Display error alert upon form submission

我希望在提交表单时,如果用户名或密码不正确,它应该显示我的警告框。对于警报消息,我使用了alertify插件,但它显示的是传统的警报框。我的代码是:

<script type='text/javascript'>
    alert({
        msg: 'Are you sure you want to delete this user',
    });
</script>

但我想要以下输出:

警报消息

为此,我使用了这个:

<script type='text/javascript'>
    alertify.alert({
        msg: 'Are you sure you want to delete this user',
    });
</script>

它显示不正确。请帮忙。

查看您正在使用的库的文档:

alertify.alert(message);

您应该传递包含消息的字符串,而不是包含包含该字符串的msg属性的对象。

alertify.alert('Are you sure you want to delete this user');