twitter-bootstrap 从锚标记触发时,Bootstrap 3 Modal 不会弹出
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29189650/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bootstrap 3 Modal won't pop up when triggering from anchor tag
提问by Beast_Code
Looking at some video tutorials I follow what has been done but don't seem to get to modal of the register link to trigger.
查看一些视频教程,我遵循已完成的操作,但似乎没有进入要触发的注册链接的模式。
Here is the link I want to trigger:
这是我要触发的链接:
<li><a href="#register-modal" data-toggle="modal" data-target="#register-modal">Register</a></li>
Here is the modal that should be triggering
这是应该触发的模态
<!-- Register Modal -->
<div class="modal fade" id="#register-modal" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h2>Register</h2>
</div>
</div>
</div>
</div>
I assume that there should be jQuery to be implemented after looking at other answers but i do not see how come if the jQuery comes from the bootstrap. The Bootstrap 3 documentation seems to do the same as I did http://getbootstrap.com/javascript/#modals-examples
我认为在查看其他答案后应该实现 jQuery,但我不明白 jQuery 是如何来自引导程序的。Bootstrap 3 文档似乎与我所做的相同http://getbootstrap.com/javascript/#modals-examples
采纳答案by Josh Crozier
The idattribute shouldn't have a hashtag.
该id属性不应具有主题标签。
Change
改变
<div class="modal fade" id="#register-modal" role="dialog"></div>
to:
到:
<div class="modal fade" id="register-modal" role="dialog"></div>

