龍巖易富通網(wǎng)絡(luò)科技有限公司

龍巖小程序開(kāi)發(fā),龍巖分銷(xiāo)系統(tǒng)

jquery 遍歷 id 或 class

2015.09.10 | 178閱讀 | 0條評(píng)論 | 未命名

html 中有個(gè)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]

贊 (

發(fā)表評(píng)論