FormatCurrency is not a function

3.8k Views Asked by At

I am trying to convert textbox value on onblur event to a $ currency using jquery.formatCurrency-1.4.0.js and my javascript function looks as follows :

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

Html:

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

Can anyone help me please?

1

There are 1 best solutions below

1
On BEST ANSWER

I think your code work fine, you have just to add the jquery-formatcurrency library :

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

Or download it will be better since googlecode.com is being deprecated like @charliefl mentioned in comment bellow.

See the implementation in fiddle HERE.