£ on input [type = text]
I have jQuery setting a value input[type=text]
like so:
if(theVal=="EPC/Floorplan"){
$('#s3').val("£100.00").attr("disabled","disabled");
$('.priceUpdate button').hide();
}else if(theVal=="EPC"){
$('#s3').val("£75.00").attr("disabled","disabled");
$('.priceUpdate button').hide();
}else{
$('#s3').val("£0.00").removeAttr("disabled");
$('.priceUpdate button').show();
}
However, the input then looks like this:
I also have the following meta tag:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
Here is the site in question. Choose any option from the dropdown menu
source to share
Use unicode:
\u00A3
In your example:
if(theVal=="EPC/Floorplan"){
$('#s3').val("\u00A3" + "100.00").attr("disabled","disabled");
$('.priceUpdate button').hide();
}else if(theVal=="EPC"){
$('#s3').val("\u00A3" + "75.00").attr("disabled","disabled");
$('.priceUpdate button').hide();
}else{
$('#s3').val("\u00A3" + "0.00").removeAttr("disabled");
$('.priceUpdate button').show();
}
source to share
The server already provides a header Content-Type
with the encoding set to ISO-8859-1
. The browser only counts your element <meta>
, unless the server provides that header itself.
Here is the relevant portion of the Firebug trace:
HTTP/1.1 200 OK
Date: Wed, 14 Mar 2012 14:19:16 GMT
Server: Apache/2.2.3 (Red Hat)
X-Powered-By: PHP/5.2.17
Content-Type: text/html; charset=ISO-8859-1
Try setting up the server (or your server-side code) to set the content encoding instead UTF-8
.
source to share