您好我正在尝试获取内容区域中当前显示的帖子的数量。当前显示的帖子数为 3,但当我检查长度时,它返回 1。
$(document).on("click", ".load-more", function() {
var currentPost = $('#postlist');
loadMore = currentPost.parent().find('.load-more');
initialPostcount = currentPost.length;
console.log(initialPostcount);
})
- 当前帖子列表:
- 检测元素:
<!-- Page: Blog Posts -->
<div id="blogposts" data-role="page">
<div data-role="header" data-position="fixed">
<h2>My Blog Posts</h2>
</div><!-- header -->
<div data-role="content">
<ul data-filter="true" data-filter-placeholder='Search blog posts...' id="postlist"> </ul><!-- content -->
</div>
<div class="load-more">Load More Posts...</div>
<div id='loader'><img src="css/images/loader.gif"/></div>
</div><!-- page -->