200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > jquery html对象 转换成字符串 JQuery - 将'HTMLDivElement'对象数组转换为字符串

jquery html对象 转换成字符串 JQuery - 将'HTMLDivElement'对象数组转换为字符串

时间:2021-04-22 15:08:37

相关推荐

jquery html对象 转换成字符串 JQuery - 将'HTMLDivElement'对象数组转换为字符串

我过滤页面上的元素,然后检查显示的项目数,如果少于一定数量,我想使用$ .get()加载更多项目。JQuery - 将'HTMLDivElement'对象数组转换为字符串

我正在使用同位素插件,它要求新项目是一个字符串,但我似乎只能得到HTMLDivElement对象。如何将其转换为字符串?

var $container = $('#container'),

filters = {};

$container.isotope({

itemSelector: '.element',

});

function loadMoreItems(getQuery) {

var newItems = [];

$.get(getQuery, null, function(data) {

container = $($container, data).eq(0);

if (0 === container.length) {

// incase the element is a root element (body > element),

// try to filter it

container = $(data).filter($container).eq(0);

}

if (container) {

container.find('.element').each(function() {

newItems.push(this);

});

}

alert(newItems); //what to do to get this as a string??

}, 'html');

$container.isotope('insert', newItems, true);

}

-11-22

LeeTee

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。