1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 5.00 out of 5)
Loading ... Loading ...

Show pound sign in input field by Javascript


If you have ever tried to put pound sign (or any special character) in any input fields by Javascript, you know that it is not that straight forward.

If we write code like this,
document.getElementById('input_field_id').value = '£1000';
It’ll display some question mark(unrecognized character) instead of the pound sign.
So we need to put character’s unicode to display it properly. In this case, the code should look like this:
document.getElementById('input_field_id').value = '\u00A31000';
where \u00A3 is the character code of £

This was bugging me a lot, so I thought it does not bug any one else :)

Bookmark and Share

,

  1. #1 by Richard on August 17th, 2010

    Great Post Javascript HTML entity pound sign

  2. #2 by DrPaul on March 9th, 2011

    Thank you, thank you, thank you, thank you, thank you!!!

    You just saved my sanity :-)

  3. #3 by MJ7 on July 6th, 2011

    Thank you – just what I was looking for.

  4. #4 by daemon on August 2nd, 2011

    hm, nice post.
    btw, I have some nice looking british pound symbol images on my site:
    http://www.britishpoundsymbol.com

    please feel free to download and use them in your documens, blogs, sites etc.

    regards

  5. #5 by Steven on October 27th, 2011

    Thanks very much! I have been searching for this answer for about an hour :-)

(will not be published)
Security Code:

  1. No trackbacks yet.