为什么这个Jquery插件滞后我的网页?

时间:2014-07-18 11:33:44

标签: javascript jquery replace webpage digits

我在google上发现这个Jquery Plug-In使元素文本中的数字中包含逗号:

$.fn.digits = function(){
return this.each(function(){
$(this).text( $(this).text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") );
})
}

并在元素上调用它:

$("#elementID").digits();

活跃时它落后于我的整个网页。我发现这是通过评论并再次运行页面而导致它的原因。当它被评论出来时,它运行顺利。有没有办法来解决这个问题?不同的脚本或插件?

0 个答案:

没有答案