0

I'm learning that using

replaceWith('<section>')

or

after('<section>')

Will actually insert the full element in each case:

<section></section>

And that when using end tags

replaceWith('</section>')

such calls seem to be ignored.

Is there someway to disable this behavior? I need to at one point in the DOM insert a start tag, and at another point insert an end tag.

wrapAll() 

I can't get to work either. I think probably something to do with what is being wrapped aren't all siblings.....

4

1 に答える 1

0

jqueryがこの種の動作を許可するとは信じていません。これにより、実際にマークアップを無効にすることができるからです。

DOM の処理 - これらのタグのグループを「ノード」として扱います。それらは、属性と値を持つオブジェクトとしてグループ化され、それらに依存する他の多くのオブジェクトになります。そのため、終了タグの単に「テキストを移動する」ことは望ましい効果ではありません...

ハーフタグの「真ん中」で必要なものをすべて取得してみませんか...新しい要素を作成し、追加で「塗りつぶし」を配置しますか? このようなもの:

var theFilling = $('ul#theFilling'),
    theCookieCrust = document.createElement('section');

$(theFilling).appendTo($(theCookieCrust));

$('ul#theFilling').remove();

$(theCookieCrust).appendTo('body');
于 2013-10-22T21:32:39.500 に答える