[英]Laravel - javascript issue with pound and euro
I have this code: 我有以下代码:
$(".range").ionRangeSlider({
min: '{{$article->lowest_bid}}',
max: '{{$article->price}}',
from: obj.price,
step: 0.1,
max_postfix: ' (usual rate)',
prefix: '{{$article->cur}}',
onChange: function (data) {
$('.price').val(data.from);
},
onFinish: function (data) {
var curr = '{{$article->cur}}';
$('.runload').text('PLACE BID ' +curr+(data.from).toFixed(2));
}
});
So this function work good and show sign £ and other ... but onFinish function there just I get 'PLACE BID £33.00'
因此,此功能运行良好,并显示了£和其他符号...但是onFinish功能仅显示
'PLACE BID £33.00'
Why {{$article->cur}} from database dont work on my onFinish ? 为什么数据库中的{{$ article-> cur}}在我的onFinish上不起作用? How to solve it?
怎么解决呢?
on line: prefix: '{{$article->cur}}', work good and show sign but onFinish dont work 在线:前缀:“ {{$ article-> cur}}”,工作正常并显示标志,但onFinish无效
The pound and euro signs are being rendered as their HTML entities , ie the escaped format so they don't interfere with code. 英镑和欧元符号被渲染为其HTML实体 ,即转义格式,因此它们不会干扰代码。
To display them correctly, you could replace the .text()
call with .html()
: 为了正确显示它们,您可以将
.text()
调用替换为.html()
:
onFinish: function (data) {
var curr = '{{$article->cur}}';
$('.runload').html('PLACE BID ' +curr+(data.from).toFixed(2));
}
This will treat the data.from
as HTML, so will render the HTML entities correctly. 这会将
data.from
视为HTML,因此将正确呈现HTML实体。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.