Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8908711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:15:09+00:00 2026-06-15T03:15:09+00:00

Using jQuery and the formatCurrency extension as below: $(function() { $(.currency).blur(function(){ formatCurrencyInput(this) }); });

  • 0

Using jQuery and the formatCurrency extension as below:

        $(function() {
            $(".currency").blur(function(){ formatCurrencyInput(this) });
        });

        function formatCurrencyInput(input) {
            if($(input).val() != '') {
                if(isNumeric($(input).val())) {
                    $(input).formatCurrency(null,{groupDigits:false,roundToDecimalPlace:2,symbol:'£'});
                    $(input).css('border-color', '');
                }
                else {
                    $(input).css('border-color', '#FFCCCC');
                }
            }
        }

All my text inputs with the “currency” class are converted from 45 => £45.00 for example.

The weird thing is if the formatCurrencyInput function is defined in the section it works fine. If I externalise the function into a .js file, it returns £45.00 (note the  character). I guess this is a character encoding issue, but how do I fix this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:15:10+00:00Added an answer on June 15, 2026 at 3:15 am

    If you use any non-Ascii character in a JavaScript file, you should make sure that the server sends proper HTTP headers for it, identifying the character encoding. Other methods, such as a charset parameter in the script element used to refer to the file, or relying on the browser defaulting the encoding somehow (e.g., from the referring HTML document), as less reliable.

    But if you have just a single non-Ascii character in a string literal, the simplest way is to escape it. The pound sign “£” U+00A3 can be escaped, inside a string literal, as \xA3 or as \u00A3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using jQuery validation - validating on blur: $('input, select, radio, checkbox').blur(function(){ $(#createAccount).validate().element(this); }); If
So I am using the Jquery plugin called FormatCurrency to (this should be obvious)
using jQuery I have the following code: var selectedIdsArray = $(#selectId option:selected).map(function(){return this.value;}); var
Using jQuery, how can I get the input element that has the caret's (cursor's)
Using jQuery and given this <ul> <li> <a external=http://stackoverflow.com href=home.htm>Link 1</a> </li> <li> <a
Using jquery, how can I find the first div that contains an input with
Using Jquery AJAX to get a value from a PHP script. This line works
Using Jquery Ajax i have an entry script index.php This script lets the user
Using JQuery: Sometimes, I can do variable.val() and it works. Sometimes, I'm required to
(using jquery) I have the following function $(function() { $('tr.parent') .css(cursor,pointer) .attr(title,Click to expand/collapse)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.