标签:
$("input[name=‘money‘]").live("keyup paste",function(){
var reg = $(this).val().match(/\d+\.?\d{0,2}/);
var txt = ‘‘;
if (reg != null) {
txt = reg[0];
}
$(this).val(txt);
}).live("change",function () {
$(this).keypress();
var v = $(this).val();
if (/\.$/.test(v))
{
$(this).val(v.substr(0, v.length - 1));
}
});
标签:
原文地址:http://www.cnblogs.com/yasong-zhang/p/5129483.html