使用jquery格式化包含内容的数据值

Formatting a data value with content using jquery

本文关键字:数据 包含内 jquery 格式化 使用      更新时间:2023-09-26

我有一个价格滑块,悬停时会显示幻灯片价格的"工具提示"。沿滑块滑动时,该值将在工具提示中更改。我想在工具提示中的值中添加£符号。我已经做到了,但英镑的位置需要纠正,因为它目前的网站是这样的:"250英镑:750英镑"。看看我模仿的展示这个的战利品——http://bootply.com/72212

            if (this.range) {
                this.tooltipInner.text(
                    this.formater(this.value[0]) + 
                    '£ : £' + 
                    this.formater(this.value[1])
                );

这样做:

this.tooltipInner.text(
   '£' + this.formater(this.value[0]) + ' : £' + this.formater(this.value[1])
);

也许我只是不明白这个问题,但它会像一样微不足道吗

this.tooltipInner.text(
    '£' +
    this.formater(this.value[0]) + 
    ' : £' + 
    this.formater(this.value[1])
)