Bootstrap のモーダル プラグインを介して、1 つのモーダル div を再利用するページ上の多数の異なるリンクを使用できるようにしたいと考えています。
<h3>This button shows a modal (<code>#utility</code>) with text "Phasellus <em>tincidunt gravida</em>..."</h3>
<br />
<a id="file_attach" data-toggle="modal" href="http://fiddle.jshell.net/jhfrench/6K8rD/show/" data-target="#utility" class="btn">Modal 1</a><br />
<h3>This button should invoke the same modal (<code>#utility</code>), but fill it with text "Phasellus <em>egestas est eu</em>..."</h3>
<br />
<a id="file_attach" data-toggle="modal" href="http://fiddle.jshell.net/jhfrench/AWSnt/show/" data-target="#utility" class="btn">Modal 2</a><br />
<!-- Modal -->
<div id="utility" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Click outside modal to close it</h3>
</div>
<div class="modal-body">
<p>One fine body…this is getting replaced with content that comes from passed-in href</p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary">Save changes</button>
</div>
</div>
href
いずれかのリンク (ボタンとしてスタイル設定されている) をクリックすると、モーダルが呼び出され、クリックされたボタンに対応するページ (の値) がモーダルに読み込まれると思います。代わりに、モーダルは、最初にクリックしたリンクのコンテンツを常にロードします。href
モーダルは、「その他」のリンクによって指示されるべきコンテンツで「更新」されません。
これは Bootstrap のバグだと思いますが、間違った使い方をしている場合に備えて、ここで質問しています。
デモンストレーションについては、http://jsfiddle.net/jhfrench/qv5u5/を参照してください。