<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>金额补充--2位小数0</title> <script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script> </head> <body> <div class="div">1.1</div> <script type="text/javascript"> var v = $(".div").html(); if (/^\d+$/.test(v)) { v = v + ".00"; } else if (/^(\d+\.)(\d+)$/.test(v)) { var i = RegExp.$1; var t = RegExp.$2; if (t.length == 1) v = v + "0"; else if (t.length > 2) v = i + t.substring(0, 2); } $(".div").html(v); </script> </body> </html>