Show DevBest Bootstrap remote Modal fix

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,638
2,393
If you're an avid Bootstrap user like myself, you've more than likely used the Modal plugin. You may also have noticed there's a feature in there where you can load content from a remote file. The only problem with it is, is that when you open the modal, the content loads -- which is fine -- but, if you close the Modal, change the content of the external file and then reopen the Modal, the content doesn't refresh.

Well, I've coded a little fix that may help you if you have the same problem as me.

Code:
$("[data-toggle='modal']").click(function(e){
    e.preventDefault();
   
    $($(this).attr("data-target") + ' .modal-body').load($(this).attr("href"), function(){
        $($(this).attr("data-target")).modal('show');
    });
});

Hope it helps.
Mark
 

jayk

Retired Habbotard.
Sep 4, 2013
517
94
I love Bootstrap. Great release, thanks man!

Going to try and make some fixes myself for Bootstrap.
 

Users who are viewing this thread

Top