就像標題所說的那樣,我需要在div內包裝一些div。這是HTML。使用jQuery將div封入到wrapper div
<div class="something1 message">
<span class="message-text">This is notification 1</span>
<input type="text" />
</div>
<div class="something2 message">
<span class="message-text">There can be multiple texts like this</span>
<span class="message-text">There can be multiple texts like this</span>
<span class="message-text">There can be multiple texts like this</span>
<input type="text" />
</div>
<div id="content-wrapper" class"message">
<span class="message-text">Anotherexample</span>
<span class="message-text">There can be multiple texts like this</span>
<input type="text" />
</div>
現在我想什麼,輸出是:
<div class="something1 message">
<div class="message-text-wrapper">
<span class="message-text">This is notification 1</span>
</div>
<input type="text" />
</div>
<div class="something2 message">
<div class="message-text-wrapper">
<span class="message-text">There can be multiple texts like this</span>
<span class="message-text">There can be multiple texts like this</span>
<span class="message-text">There can be multiple texts like this</span>
</div>
<input type="text" />
</div>
<div id="content-wrapper" class"message">
<div class="message-text-wrapper">
<span class="message-text">Anotherexample</span>
<span class="message-text">There can be multiple texts like this</span>
</div>
<input type="text" />
</div>
基本上所有的「消息文本」跨度是invidual消息div中會我們包裹在裏面消息文本wrappe DIV。
希望你明白。
你打算把'單跨度'還是'多跨度',看起來你們都混在一起了。 – Deeptechtons