MVC, Twitter bootstrap modal dynamically loaded from partial via jquery -
i have mvc layout has standard bootstrap modal div etc (http://getbootstrap.com/javascript/#modals).
on click of action link (where view uses bootstrap modal layout) have following jquery
1
$(".popupdialog").click(function (e) { e.preventdefault(); $('<div></div>').load(this.href, function () { $(this).find('#mymodal').modal(); }); });
it doesn't load modal @ all.
if remove outer div standard twitter bootstrap modal , place in jquery, i.e.
2
$(".popupdialog").click(function (e) { e.preventdefault(); $('<div class="modal fade" id="mymodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true"></div>').load(this.href, function () { $(this).modal(); }); });
it works great don't want dynamically load 1st outer div in jquery in 2.
i've tried unwrapping first div in 1 before calling .modal() still no joy.
any great!
silly mistake.
after putting placeholder div html markup , using load modal html works fine.
$(".popup-dialog-link").click(function (e) { e.preventdefault(); $('popup-dialog-modal').load(this.href, function () { $(this).find('#mymodal').modal(); }); });
Comments
Post a Comment