Munny Munny - 4 months ago 47
Ajax Question

formatCurrency is not a function

I am trying to convert textbox value on onblur event to a

$
currency using
jquey.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

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.