I'm building a website using bootstrap
. But i'm come to somewhat of an dead-end. i've created a modal from an given example (see below). As you might see, this is a modal taken straight from their website.
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel">Nieuwe Taak toevoegen</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
</div>
I open this dialog using a button.
<button type="button" class="btn btn-default btn-sm" data-toggle="modal" data-target="#myModal" >
But i want to keep my modals in seperate aspx/html-files
. How can i open these modals when they are kept inside different html/aspx - files
?
example:
if the button is inside index.Html
but the modal is inside newTaskModal.html
, how would i open the modal? (If both are inside index.html, then there are no problems)
Note: I don't/can't use HTML5 (company-standards)
Also you could if you are using JQuery to load your html page into into a matched element.
Go to http://api.jquery.com/load/ for more info.
Can you use PHP? If so there is simple solution.
Your index will be index.php and where you want to have your modal just place this code
if you're using jquery, you could download the page using an ajax call:
If you're building a single page application you might want to check out a framework designed to solve this type of problem: durandal
STEP 1 Use below code for link:
STEP 2 Use below code for modal window
STEP 3 Create MyModal.html and place some text.
Note: This may not work local html. works only on server!