I am creating a set of pages which have sections loaded dynamically by ajax.
Each loaded ajax page is just html content and contains a modal.
I have tinyMCE editors which had the same problem but I have fixed that one by clearing all editors from the editors array and reloading them.
tinyMCE.editors = [];
tinyMCE.init();
I am looking to do something similar with Bootstrap Modals. I understand that the updated DOM is not known about by bootstrap and that placing a script tag at the end would resolve this issue BUT by doing that, it also introduces problems as the scripts will have been previously loaded for previous parts of the page (multiple loads of the same script).
The reason I am looking to do this is this.
- Create button to open modal
- Modal opens
- Click close or the x on the modal, nothing happens
Closing code:
<button type="button" class="close" data-dismiss="modal">×</button>
My opening code:
<a href="#" id="adminAdd" class="adminClicks btn btn-sm btn-success" data-toggle="modal" data-target="#addModal">Add<span class="glyphicon glyphicon-plus"></span></a>
Dialog div:
<div id="addModal" class="modal fade" role="dialog">
Any advice would be great. I have used a modal which works correctly at the highest level where the page is not changed by ajax.