I am using Twitter bootstrap modals To load data from a table.
Here is my HTML code.
<tr>
....
<td> <a href="http://google.com">Text</a> </td>
....
</tr>
and this is the Modal div at the end of the page like so
<div id="modal"></div>
What I’m trying to achieve is by clicking the link inside the cell I want to contents of the modal to be updated & then after it finishes updating to open the modal automatically. Here is what I tried.
$('td').on('click','a',function(){
var href = $(this).attr('href');
$('#modal').load(href,function(){
$(this).modal({
keyboard:true,
backdrop:true
});
});
It doesn’t give me any errors & actually the HTML gets loaded successfully in the Modal div but it doesn’t load the modal after updating the HTML it needs another “Click”?! & I don’t know why?
Have you tried
right after instantiating the modal ?