如何以编程方式触发Bootstrap模式?

编程入门 行业动态 更新时间:2024-10-26 11:16:34
本文介绍了如何以编程方式触发Bootstrap模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果我去这里

getbootstrap/2.3.2/javascript.html#modals

然后点击启动演示模式它会完成预期的操作。我正在使用模式作为我的注册过程的一部分,并且涉及服务器端验证。如果有问题,我想将用户重定向到同一模式,并显示我的验证消息。目前我无法弄清楚除了来自用户的物理点击之外如何显示模态。如何以编程方式启动模型?

And click 'Launch demo modal' it does the expected thing. I'm using the modal as part of my signup process and there is server side validation involved. If there are problems I want to redirect the user to the same modal with my validation messages displayed. At the moment I can't figure out how to get the modal to display other than a physical click from the user. How can I launch the model programmatically?

推荐答案

为了手动显示模态弹出窗口,您必须执行此操作

In order to manually show the modal pop up you have to do this

$('#myModal').modal('show');

您之前需要使用 show:false 所以直到你手动完成它才会显示。

You previously need to initialize it with show: false so it won't show until you manually do it.

$('#myModal').modal({ show: false})

其中 myModal 是模态容器的名称。

Where myModal is the name of the modal container.

更多推荐

如何以编程方式触发Bootstrap模式?

本文发布于:2023-05-23 14:44:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1326149.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:模式   方式   Bootstrap

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!