我有一个<li>
,当点击它时,我希望在执行某个动作之前打开一个模态。这可能吗?由于我发现的所有模态示例都与button
有关,但我不想改变它。
这是我正在使用的代码(以及到目前为止我尝试过的代码)
模态
<!-- Modal -->
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal header</h3>
</div>
<div class="modal-body">
Are you sure you want to Add an Iteration?
</div>
<div class="modal-footer">
@using (Html.BeginForm("AddNewIteration", "Index"))
{
@Html.AntiForgeryToken()
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-warning">Add Iteration</button>
}
</div>
</div>
关注 <li>
<!-- Start of Add New Iteration -->
<li>
<a href="#myModal" data-toggle="#myModal">
<span class="ca-icon"><i class="fa fa-plus-square fa-3x"></i></span>
<div class="ca-content">
<h2 class="ca-main"> Add new Iteration</h2>
<h3 class="ca-sub"> Add New Iteration to the Project!</h3>
</div> <!-- End of ca-content-->
</a>
</li> <!-- Add New Iteration -->
提前致谢
答案 0 :(得分:3)
无所谓,我发现我做错了什么。 声明标签错误必须将其更改为:
<a href="#" data-toggle="modal" data-target="#myModal">