Reputation: 75
I am trying to show the British pound sign but it is not working. I have try using the html codes for pound signs still nothing.
I have try this
var price = '£' + parseInt($('#pricetag').text(),10) * qty;
Jquery
<script>
$(document).ready(function()
{
$('#selected').hide();
$('#button').click(function()
{
var qty = $('#Qty').val();
var price = '£' + parseInt($('#pricetag').text(),10) * qty;
$('#sprice').text(price);
$('#selected').slideDown();
});
});
</script>
Upvotes: 1
Views: 103
Reputation: 24332
Try this,
var price = '£' + parseInt($('#pricetag').text(),10) * qty;
$('#sprice').html(price);
Upvotes: 1
Reputation: 5138
To quote Douglass Crockford via JSLint:
There are characters that are handled inconsistently in browsers, and so must be escaped when placed in strings. \u0000-\u001f \u007f-\u009f \u00ad \u0600-\u0604 \u070f \u17b4 \u17b5 \u200c-\u200f \u2028-\u202f \u2060-\u206f \ufeff \ufff0-\uffff
I highly suggest you use the unicode escape for £ \u00A3
that should fix the issue.
Upvotes: 4