使用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);

        }

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。