gpt4 book ai didi

javascript - NaN Jquery 旋钮

转载 作者:行者123 更新时间:2023-11-28 18:29:41 27 4
gpt4 key购买 nike

我正在尝试删除 jquery 旋钮上显示的 NaN。我尝试了一些方法,例如设置超时和调整倒计时器。如何修复我的旋钮,使其在首次调用时不再显示 NaN?

示例http://codepen.io/missile20706/pen/jAaYjx

$.fn.timer = function( userdefinedoptions ){ 
var $this = $(this), opt, count = 0;


opt = $.extend( {
// Config
'timer' : 30, // 300 second default
'width' : 100 ,
'height' : 100 ,
'fgColor' : "blue" ,
'bgColor' : "white"
}, userdefinedoptions
);


$this.knob({
'min':0,
'max': opt.timer,
'readOnly': true,
'width': opt.width,
'height': opt.height,
'fgColor': opt.fgColor,
'bgColor': opt.bgColor,
'displayInput' : true,
'dynamicDraw': false,
'ticks': 0,
'thickness': 0.3
});


setInterval(function(){
newVal = ++count;
$this.val(newVal).trigger('change');
}, 1000);
};

$('.example').timer();

最佳答案

只需将输入的初始值设置为“0”

<input class="example" value="0">

关于javascript - NaN Jquery 旋钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38340299/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com