我想在我的HTML中動態添加此警告div SecondDiv。 請建議我們在jquery中如何實現這一點。jquery - 動態添加div到
HTML:
<div class="panel panel-default">
<div class="panel-heading">
</div>
<div class="panel-body">
<div class="table-responsive" id="FirstDiv">
</div>
<hr/>
<div class="table-responsive" id="SecondDiv">
</div>
<hr/>
<div class="table-responsive" id="ThirdDiv">
</div>
</div>
</div>
警告DIV:
<div class="note note-warning">
<div class="block-warning">
<h4 class="block"> <i class="demo-icon icon-attention-1 fa"></i> Warning! Some Header Goes Here</h4>
<p>Warning </p>
</div>
</div>
這是什麼意思,由'動態'在這裏,在什麼情況下? – Satpal
document.getElementById('SecondDiv')。appendChild(document.getElementById('warningDiv');.我會在您的警告div中添加一個ID以添加此方式 – thatOneGuy
$(「#SecondDiv」)。append($(「 #warningDiv「)。html()) – Rajesh