使用Jquery后去div个数

<div id="tree1" class="tree-folder-content">
<div class="tree-folder">1</div>
<div class="tree-folder">1</div>
<div class="tree-folder">1</div>
<div class="tree-folder">1</div>
<div class="tree-folder">1</div>
</div>

获取class="tree-folder"的 div个数

    function add() {
var count = $("#tree3 >.tree-folder").size() + 1;//获取class="tree-folder"的个数
var htmls = '<div class="tree-folder 3t' + count + '"style="display: block;"><div class="tree-folder-header" ><i class="icon-folder-open"></i><div class="tree-folder-name">我靠<div class="tree-actions"><i class="icon-remove" onclick="remove3(' + count + ')"></i> <i class="icon-edit" onclick="edit1()"></i></div></div></div><div class="tree-folder-content"></div></div>';
$('#tree1').append(htmls); }
上一篇:C/C++ 和 PHP 技术经典图书,学习视频资料总结


下一篇:thinkphp5使用redis实现秒杀商品活动