Show pound sign in input field by JavaScript or jQuery
Pound sign in input field by JavaScript or jQuery, if anyone has
tried pound (£) sign (or any special character) in any input fields
by JavaScript or jQuery, then you know it is not straight
forward.
If we write code like this,
//JavaScript
document.getElementById('input_filed_id').value = '£100';
//jQuery
$('input_field_id_OR_class').val('£100');
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:
//JavaScript
document.getElementById('input_filed_id').value = '\u00A3100';
//jQuery
$('input_field_id_OR_class').val('\u00A3100');
where \u00A3 is the character code of £
Thank you and have nice day