2

我正在尝试将 onblur 事件上的文本框值转换为$货币jquery.formatCurrency-1.4.0.js,我的javascript函数如下所示:

$(document).ready(function()
{
    $('.currency').blur(function()
    {
        $('.currency').formatCurrency();
    });
});

html:

<input type="textbox"  id="currencyField" class="form-control currency" placeholder="Enter Price"/>

任何人都可以帮助我吗?

4

1 回答 1

0

我认为您的代码工作正常,您只需添加jquery-formatcurrency库:

https://jquery-formatcurrency.googlecode.com/files/jquery.formatCurrency-1.4.0.min.js

或者下载它会更好,因为 googlecode.com 已被弃用,就像下面评论中提到的 @charliefl 一样。

请参阅小提琴HERE中的实现。

于 2015-10-20T22:25:18.160 回答