简体   繁体   English

jQueryUI滑块-固定值(2)

[英]jQueryUI Slider - Value toFixed(2)

I have the following line of code in jQuery: 我在jQuery中有以下代码行:

$( "#amount-deposit" ).val( "" + $( "#slider-deposit" ).slider( "value" ) );

I'd like to apply toFixed(2) to amount deposit. 我想申请toFixed(2)进行存款。 I'm unsure how I can do this in this instance though, can anyone suggest how I might do this. 我不确定在这种情况下如何执行此操作,任何人都可以建议我如何执行此操作。

Thanks 谢谢

Looking at the api :- 看着api :-

value() 值()

Returns: Number 返回: 数字

Get the value of the slider. 获取滑块的值。 This signature does not accept any arguments. 该签名不接受任何参数。 Code examples: Invoke the method: 代码示例:调用方法:

var selection = $( ".selector" ).slider( "value" ); var selection = $(“ .selector”).slider(“ value”);

So, all you need to do is:- 因此,您需要做的是:

$( "#amount-deposit" ).val( "" + $( "#slider-deposit" ).slider( "value" ).toFixed(2));

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM