hi
How to open modal on navbar Items click using bootstrap4
below is Modal codes in bootstrap4
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#staticBackdrop">
Launch static backdrop modal
</button>
<div class="modal fade" id="myModal">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<h4 class="modal-title">
Modal Heading</h4>
<button type="button" class="close" data-dismiss="modal">
×</button>
</div>
<!-- Modal body -->
<div class="modal-body">
<div class="control-group">
<label for="contact-name" class="control-label">
Name:</label>
<div class="controls">
<input type="text" id="contact-name" />
</div>
</div>
<div class="control-group">
<label for="contact-email" class="control-label">
Email:</label>
<div class="controls">
<input type="email" id="contact-email" />
</div>
</div>
<div class="control-group">
<label for="contact-message" class="control-label">
Message:</label>
<div class="controls">
<textarea name="contact-message" id="contact-message" cols="30" rows="10"></textarea>
</div>
</div>
<div class="control-group">
<div class="controls">
<input type="submit" class="btn btn-primary" value="Send Message" />
</div>
</div>
</div>
<!-- Modal footer -->
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">
Close</button>
</div>
</div>
</div>
</div>
here when click button it will show modal on the page now I want instead of clicking button to show modal in the page, click on <a> tag from navigations menu to show Modal:
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
</li>
</ul>
</div>
</nav>
I mean I want when I click on Pricing in navbar it opens Modal
how I can do it?
Best regards
Neda