标签:sha 赋值 src meta orm console utf-8 dev lan
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta http-equiv="X-UA-Compatible" content="ie=edge" /> <title>Document</title> </head> <body> <table> <tr> <td class="feeFormat"> 95.121001 </td> <td class="feeFormat"> 93.543001 </td> <td class="feeFormat"> 22.45345 </td> <td class="feeFormat"> 54543.545 </td> </tr> </table> <script src="jquery.min.js"></script> <script> $("table:eq(0) tr").each(function(index, element) { var a = $(element).children(); //$(element)代表每行tr,后面的children代表tr下面的td,a即这一行所有td的集合 for(var i = 0; i < a.length; i++) { console.log(a.eq(i).text()); // 取得index为 i的td里面的文本 var num = parseFloat(a.eq(i).text()); var newNum = num.toFixed(2); a.eq(i).text(newNum); } }); </script> </body> </html>
标签:sha 赋值 src meta orm console utf-8 dev lan
原文地址:http://www.cnblogs.com/TigerZhang-home/p/7459597.html