检索缓存的jquery元素

时间:2013-11-21 09:41:52

标签: jquery performance

我正在缓存像这样的jquery元素

var $stepList = $('#stepList > li');
var $tableRowList = $('.tablesorter-js tbody > tr');

//and use them in the function
pages = {
    buildDetail: function ($stepList, $tableRowList) {
          console.log($stepList, $tableRowList)
    });
}
// this function is invoked many times
pages.buildDetail($stepList, $tableRowList);

是否有更有效的方法来缓存和检索元素,因为我在buildDetail()中会有更多缓存元素?

0 个答案:

没有答案