<tfoot id='njv8V'></tfoot>

    <i id='njv8V'><tr id='njv8V'><dt id='njv8V'><q id='njv8V'><span id='njv8V'><b id='njv8V'><form id='njv8V'><ins id='njv8V'></ins><ul id='njv8V'></ul><sub id='njv8V'></sub></form><legend id='njv8V'></legend><bdo id='njv8V'><pre id='njv8V'><center id='njv8V'></center></pre></bdo></b><th id='njv8V'></th></span></q></dt></tr></i><div id='njv8V'><tfoot id='njv8V'></tfoot><dl id='njv8V'><fieldset id='njv8V'></fieldset></dl></div>
  1. <legend id='njv8V'><style id='njv8V'><dir id='njv8V'><q id='njv8V'></q></dir></style></legend>

    <small id='njv8V'></small><noframes id='njv8V'>

        <bdo id='njv8V'></bdo><ul id='njv8V'></ul>
    1. Jquery - 追加与追加

      Jquery - Append vs AppendTo(Jquery - 追加与追加)
          <tbody id='9yYiH'></tbody>

        • <small id='9yYiH'></small><noframes id='9yYiH'>

          <i id='9yYiH'><tr id='9yYiH'><dt id='9yYiH'><q id='9yYiH'><span id='9yYiH'><b id='9yYiH'><form id='9yYiH'><ins id='9yYiH'></ins><ul id='9yYiH'></ul><sub id='9yYiH'></sub></form><legend id='9yYiH'></legend><bdo id='9yYiH'><pre id='9yYiH'><center id='9yYiH'></center></pre></bdo></b><th id='9yYiH'></th></span></q></dt></tr></i><div id='9yYiH'><tfoot id='9yYiH'></tfoot><dl id='9yYiH'><fieldset id='9yYiH'></fieldset></dl></div>

              <bdo id='9yYiH'></bdo><ul id='9yYiH'></ul>
                <tfoot id='9yYiH'></tfoot>

              1. <legend id='9yYiH'><style id='9yYiH'><dir id='9yYiH'><q id='9yYiH'></q></dir></style></legend>
              2. 本文介绍了Jquery - 追加与追加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                谁能解释一下为什么常规的 Append into a loop 比 AppendTo 效果更好?

                Can somebody explain me why regular Append into a loop works better than AppendTo?

                //Using Regular Append
                var ul = $("<ul></ul>");
                $("#myDiv").empty().append(ul)
                
                $.each(movies, function (count, item) {
                    var id = 'li_' + count;
                    ul.append('<li id=' + id + '>' + item + '</li>');
                
                    $('#' + id).click(function () { });
                });
                
                //Using AppendTo
                var div = $("#myDiv").empty(),
                    ul = $("<ul></ul>").appendTo(div);
                
                $.each(movies, function (count, item) {
                    $('<li>' + item + '</li>').click(function () { }).appendTo(ul);
                });
                

                结果http://jsperf.com/sdp-jquery-append/3

                推荐答案

                append(content) 将内容追加到每个匹配元素的内部.

                append(content) appends content to the inside of every matched element.

                appendTo(selector) 将所有匹配的元素附加到另一组指定的元素.

                appendTo(selector) appends all of the matched elements to another specified set of elements.

                这篇关于Jquery - 追加与追加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                Toggle HTML radio button by clicking its label(通过单击标签来切换 HTML 单选按钮)
                Javascript how to change radio button label text?(Javascript如何更改单选按钮标签文本?)
                JavaScript radio button confirmation(JavaScript 单选按钮确认)
                How can I automatically select specific radio buttons with Greasemonkey?(如何使用 Greasemonkey 自动选择特定的单选按钮?)
                AngularJs. Is it possible to deselect HTML “radio” input by click?(AngularJs.是否可以通过单击取消选择 HTML“收音机输入?)
                Checking Value of Radio Button Group via JavaScript?(通过 JavaScript 检查单选按钮组的值?)

                  <tbody id='ujjSp'></tbody>

                <i id='ujjSp'><tr id='ujjSp'><dt id='ujjSp'><q id='ujjSp'><span id='ujjSp'><b id='ujjSp'><form id='ujjSp'><ins id='ujjSp'></ins><ul id='ujjSp'></ul><sub id='ujjSp'></sub></form><legend id='ujjSp'></legend><bdo id='ujjSp'><pre id='ujjSp'><center id='ujjSp'></center></pre></bdo></b><th id='ujjSp'></th></span></q></dt></tr></i><div id='ujjSp'><tfoot id='ujjSp'></tfoot><dl id='ujjSp'><fieldset id='ujjSp'></fieldset></dl></div>

                <small id='ujjSp'></small><noframes id='ujjSp'>

                • <legend id='ujjSp'><style id='ujjSp'><dir id='ujjSp'><q id='ujjSp'></q></dir></style></legend>
                    <bdo id='ujjSp'></bdo><ul id='ujjSp'></ul>

                          <tfoot id='ujjSp'></tfoot>