I'm following this example in my Laravel application. I have included the js file in the layout file as follows:
<script type="text/javascript" src=""></script>
The test.js file has following content (exactly as in the Plunker file):
$('#edit-modal').on('show.bs.modal', function(e) {
var $modal = $(this),
esseyId = e.relatedTarget.id;
$modal.find('.edit-content').html(esseyId);
});
In my view file I have (exactly as in the Plunker file) the following:
<div><a href="#myModal" data-toggle="modal" id="w" data-target="#edit-modal">Edit 1</a></div>
<div><a href="#myModal" data-toggle="modal" id="q" data-target="#edit-modal">Edit 2</a></div>
<div><a href="#myModal" data-toggle="modal" id="d" data-target="#edit-modal">Edit 3</a></div>
<div id="edit-modal" class="modal fade" 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">Modal title</h4>
</div>
<div class="modal-body edit-content">
...
</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>
On the page that needs to show the dialog box, I'm sure the test.js is loaded as I can see the content of the js file (using view page source).
While in the Plunker example, the content is shown depending on the link once clicks, I always see the ... instead of the id's from the 'a href'.
Looks like the JS is not inserting the html content into the modal-body edit-content area. Any suggestion on how to debug this?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire