一個div deferents HTML標籤我有HTML下面幾行:總結與使用jQuery
<header class="title">
<h3>Billing Address</h3>
</header>
<address>
<p>Address</p>
</address>
而且我想使用jQuery新div
之間來包裝他們,因爲我沒有訪問HTML。
如果我使用.before()
和.after()
,這是行不通的
$('header').before('<div="new-div">');
$('address').after('</div>');
我試圖與.wrap()
和.append()
,但也不起作用。
結果shoulbe是:
<div class="new-div">
<header class="title">
<h3>Billing Address</h3>
</header>
<address>
<p> Address </p>
</address>
</div>
謝謝!
無關的問題一起,但不應該使用的地址標籤隨便一個ddress。根據規範,它只能用於特定頁面,部分或文章的聯繫信息。鑑於您的帳單地址標題「,這不符合此標準,因此應使用ap。 –
感謝Ian Devlin的評論。正如我所說,我無法訪問html :(但我會要求更正:)感謝收益 – andresgl