タイトルとして、リモートコンテンツのボタンを使用してモーダルを閉じるにはどうすればよいですか?ここで リモートコンテンツのボタンでモーダルを閉じるにはどうすればいいですか?
は元のページ、index.htmlにある:<a href="modal.html" data-toggle="modal" data-target="#testModal">open modal</a>
<div id="testModal" class="modal fade">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
</div>
</div>
</div>
と、ここで私は、モーダルで開きたいページがある、modal.html:
<p>Hi, I am a modal</p>
<button class="btn btn-primary">close</button>
<script type="text/javascript">
$(function() {
$("#closeModal").click(function() {
// do something...(Ajax)
$("#testModal").modal('hide');
});
});
</script>
と私は近いが欲しいですボタンを押してindex.htmlのモーダルを閉じますが、data-dismiss
は使用しません。ここではPlunkerの完全な例があります:http://plnkr.co/edit/EGjtma?p=info
にこれを読んで:http://stackoverflow.com/questions/16493280/close-bootstrap-modal – ZiTAL
@ZiTALドゥあなたは 'toggle'を使ってモーダルを閉じることを意味しますか?私はすでにトグルを設定していますが、私はまだボタンがモーダルを閉じることができます。 –
"funciton"が間違っています。 "function"を使用し、ブラウザーでコンソールを開いてFirefoxのエラーを見てください。firebug – ZiTAL