Bootstrap上的jQuery验证插件错误消息5.x弹出案

发布于 2025-01-31 16:26:53 字数 62 浏览 3 评论 0原文

我正在使用Bootstrap 5.x版本弹出式jQuery验证插件,但无法弄清楚正确的解决方案,请帮助任何人?

I am using jquery validation plugin with bootstrap 5.x version popovers, but not able to figure out the right solution, please help any one ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浮生面具三千个 2025-02-07 16:26:54

经过长时间的研究,我在Bootstrap上找到了jQuery验证插件错误消息的答案5.x Popovers

    jQuery.validator.setDefaults({
        showErrors: function (errorMap, errorList) {
            $.each(this.successList, function (index, value) {
                return bootstrap.Popover.getInstance(value).hide();
            });
            return $.each(errorList, function (index, value) {
                bootstrap.Popover.getOrCreateInstance(value.element, {
                    trigger: "manual",
                    placement: "bottom",
                    content: value.message,
                });
                bootstrap.Popover.getInstance(value.element)._config.content = value.message;
                bootstrap.Popover.getInstance(value.element).setContent();
                return bootstrap.Popover.getInstance(value.element).show();
            });
        }
    });

After my long research, i found a answer for jquery validation plugin error messages on bootstrap 5.x popovers

    jQuery.validator.setDefaults({
        showErrors: function (errorMap, errorList) {
            $.each(this.successList, function (index, value) {
                return bootstrap.Popover.getInstance(value).hide();
            });
            return $.each(errorList, function (index, value) {
                bootstrap.Popover.getOrCreateInstance(value.element, {
                    trigger: "manual",
                    placement: "bottom",
                    content: value.message,
                });
                bootstrap.Popover.getInstance(value.element)._config.content = value.message;
                bootstrap.Popover.getInstance(value.element).setContent();
                return bootstrap.Popover.getInstance(value.element).show();
            });
        }
    });
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文