Reputation: 2251
I have an anchor tag in my navbar which I'd like to use to open up a modal form as a helper page. I have used the default W3Schools modal form just to test it it works. However nothing opens, I know it has something to do with the href. But i'm just not sure how to point the href to a modal form.
HTML:
<div class="collapse navbar-collapse" id="PageNavigation">
<ul class="nav navbar-nav" id="NavigationLinks">
<li>@Html.ActionLink("DASHBOARD", "Index", "Dashboard", "", new { @class = "MainNavText", @id = "MainNavDashboard" })</li>
<li>@Html.ActionLink("EXPORT", "Index", "Dashboard", "", new { @class = "MainNavText", @id = "MainNavExport" })</li>
<li><a data-target="#myModel" data-toggle="modal" class="MainNavText" id="MainNavHelp">HELP</a></li>
</ul>
@Html.Partial("_LoginPartial")
</div>
<div id="myModal" 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">Modal Header</h4>
</div>
<div class="modal-body">
<p>Some text in the modal.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
How can I do this?
Upvotes: 15
Views: 105396
Reputation: 2251
Found it.
<li>
<a data-target="#myModal" data-toggle="modal" class="MainNavText" id="MainNavHelp"
href="#myModal">HELP</a>
</li>
Just needed to set the id to the href
.
Upvotes: 34