0
4

2 に答える 2

0

tymeJV はそれをかなりうまく捉えているようです。セレクターのキャッシュと DOM の更新に基づいて、いくつかの変更が提案されました。

var $h = $("<div>");//create a holder for the new elements

$('div.team_text').each(function() {
     var $this = $(this);//cache 'this'
     $h.append(
     $('<a>').attr({//I use the attr method to add the properties, I think that it is easier to read.
          "href" : $this.attr("id"),
          "text" : $this.find("h3").text()
        }).wrap("<li>")
        );
});

$('ul.tabs').append($h.children());

この回答に付加価値がなければ、削除します!

于 2013-10-29T18:28:18.023 に答える