UmarAbbasKhan UmarAbbasKhan - 1 month ago 18
HTML Question

How to populate currency symbols in html 5 input element

I have the following html Input element:

<input size=6 type="text" id="prd_price" title="prd_price" name="prd_price" >


I have Currency Symbol ман for "Azerbaijani manat
" saved in the database. I would like to populate this as the symbol inside HTML Input element and perhaps concatenate with the price of a product. But when I populate the Input Element dynamically with the UTF-8 Code, it remains in the code form and does not become the Currency Symbol it is suppose to become.

Anyone knows what am I missing here...

Answer

First of all I got the UTF-8 Code for Azerbaijani manat ман which is able to be run in javascript from "https://r12a.github.io/apps/conversion/". In this case it came up to be \u043C\u0430\u043D. Then I ran it up with the following code to get it display inside the input element using javascript:

var x = "\u043C\u0430\u043D";
var r = /\\u([\d\w]{4})/gi;
x = x.replace(r, function (match, grp) {
    return String.fromCharCode(parseInt(grp, 16)); } );
x = unescape(x);
console.log(x);