を消える:prependTo要素を使用すると、私は次のようHMTLを持って
<div class="modal fade in" id="data-confirmation-modal" tabindex="-1" role="dialog" aria-labelledby="data-confirmation-modal-label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<span class="fa fa-exclamation-triangle"></span>
<h4 class="modal-title" id="data-confirmation-modal-label">Titile</h4>
</div>
<div class="modal-body">
<p>Example</p>
</div>
<div class="modal-footer">
<button id="" type="button" class="btn-confirm">Conform</button>
<button type="button" class="btn-cancel" autofocus="" data-dismiss="modal">Avbryt</button>
</div>
</div>
</div>
</div>
私はフォーム要素を作成し、javasciptでフォーム要素内のモーダルコンテンツを置くしようとしています:
$form = $("<form></form>");
$form.prependTo($('.modal-content'));
私が使用している場合上記のコード私はモーダルが空です。助けていただければ幸いです。 私は以下のようなHTMLになりたい:
<div class="modal fade in" id="data-confirmation-modal" tabindex="-1" role="dialog" aria-labelledby="data-confirmation-modal-label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<form>
<div class="modal-header">
<span class="fa fa-exclamation-triangle"></span>
<h4 class="modal-title" id="data-confirmation-modal-label">Titile</h4>
</div>
<div class="modal-body">
<p>Example</p>
</div>
<div class="modal-footer">
<button id="" type="button" class="btn-confirm">Conform</button>
<button type="button" class="btn-cancel" autofocus="" data-dismiss="modal">Avbryt</button>
</div>
</form>
</div>
</div>
</div>
私が間違っていない場合、['prependTo()'](http://api.jquery.com/prependto/)はラッピングには使用されません。これは、ターゲット要素の先頭に別の要素を追加/転送するために使用されます – Swellar