1

I have this table where, When a user clicks on a row, should open a modal with some information regarding that row. Since the content of this Modal is on another HTML file within my project, I don't know how to accomplish it.

So far, I can do this for each row:

<tr data-toggle="modal" href="../clients/edit.html" data-id="10238" data-target=".clientEditModal"> <td>10238</td> <td>[email protected]</td> <td>14.10.2013</td> </tr> 

I'd like to do something like this via Javascript:

$(".table-clickable").find("tr").dblclick(function(){ $('.clientEditModal').modal('show'); }); 

Is there a way to specify an HTML file to load as a model using Javascript modal('show')?

1
  • With the Bootstrap 3.3 update and deprecation, the linked answer is no longer useful. Commented Aug 3, 2017 at 21:01

1 Answer 1

2

The ability to use remote urls has been deprecated in the most recent versions of bootstrap. Try something along the lines of

// Fill modal with content from link href $("#myModal").on("show.bs.modal", function(e) { var link = $(e.relatedTarget); $(this).find(".modal-body").load(link.attr("href")); }); 

for full context please see marcovtwout's answer over at: Load content with ajax in bootstrap modal

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.