How to use Bootstrap modal using the anchor tag for Register?(如何使用注册的锚标签使用引导模式?)
问题描述
我的导航栏有一个锚标记列表.单击注册"时,我想打开一个模式.代码如下:
I have a list of anchor tags for my navigation bar. I want to open a modal when "Register" is clicked. Here is the code:
<li><a href="@Url.Action("Login", "Home")">Login</a></li>
<li><a href="#"> data-toggle="modal" data-target="modalRegister"> Register</a></li>
<div id="modalRegister" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title" style="text-align-last: center">Register</h4>
</div>
<div class="modal-body">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
我通常使用按钮打开模式,但由于 <a href""></a>.我怎样才能达到效果?
I normally use a button to open a modal, but I'm not quite sure how I would open it using the <a></a> tag because of the <a href""></a>. How can I achieve the results?
推荐答案
您将不得不修改以下行:
You will have to modify the below line:
<li><a href="#" data-toggle="modal" data-target="modalRegister">Register</a></li>
modalRegister 是 ID,因此需要前面的 # 用于 html 中的 ID 引用.
modalRegister is the ID and hence requires a preceding # for ID reference in html.
因此,修改后的 html 代码片段如下:
So, the modified html code snippet would be as follows:
<li><a href="#" data-toggle="modal" data-target="#modalRegister">Register</a></li>
这篇关于如何使用注册的锚标签使用引导模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何使用注册的锚标签使用引导模式?
基础教程推荐
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
