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: Log
Solution 1:
You will have to modify the below line:
<li><ahref="#"data-toggle="modal"data-target="modalRegister">Register</a></li>
modalRegister
is the ID and hence requires a preceding #
for ID reference in html.
So, the modified html code snippet would be as follows:
<li><ahref="#"data-toggle="modal"data-target="#modalRegister">Register</a></li>
Solution 2:
https://www.w3schools.com/bootstrap/bootstrap_ref_js_modal.asp
Note: For <a>
elements, omit data-target, and use href="#modalID"
instead.
Solution 3:
Here is a link to W3Schools that answers your question https://www.w3schools.com/bootstrap/bootstrap_ref_js_modal.asp
Note: For anchor tag elements, omit data-target, and use href="#modalID" instead:
I hope that helps
Solution 4:
Just replace it:
<li><ahref=""data-toggle="modal"data-target="#modalRegister">Register</a></li>
Instead of:
<li><ahref="#"data-toggle="modal"data-target="modalRegister">Register</a></li>
Solution 5:
This is your code
<li><a href="#"> data-toggle="modal" data-target="modalRegister"> Register</a></li>
in your code, you have to change like below
<li><ahref="#"data-toggle="modal"data-target="#modalRegister"> Register</a></li>
Post a Comment for "How To Use Bootstrap Modal Using The Anchor Tag For Register?"