龙岩易富通网络科技有限公司

龙岩小程序开发,龙岩分销系统

jquery 遍历 id 或 class

2015.09.10 | 206阅读 | 0条评论 | 未命名

html 中有个ID [php] <span class="total">1</span> <span class="total">2</span> <span class="total">3</span> <span class="total">4</span> [/php] 利用jquery遍历id 获取累加和: [php] $a=0; $(".total").each(function(){ $a += Number($(this).text()); }); alert($a); [/php]

赞 (

发表评论