Javascript 检测jQuery旋钮值
大家好,我花了几个小时试图解决这个小问题,我想用它在每个点触发不同的jQuery动画。我似乎无法检测到这个值Javascript 检测jQuery旋钮值,javascript,jquery,Javascript,Jquery,大家好,我花了几个小时试图解决这个小问题,我想用它在每个点触发不同的jQuery动画。我似乎无法检测到这个值 <script> $(document).ready(function(){ $('.knob').bind('change', function(){ var newvalue = $(this).val(); if (newvalue == 50) { alert("n
<script>
$(document).ready(function(){
$('.knob').bind('change', function(){
var newvalue = $(this).val();
if (newvalue == 50) {
alert("newvalue is 50!");
};
});
});
</script>
<input class="knob" data-width="530" data-min="0" data-max="67" data-angleOffset="0" data-thickness=".1" data-displayPrevious="true">
$(文档).ready(函数(){
$('.knob').bind('change',function(){
var newvalue=$(this.val();
如果(newvalue==50){
警报(“新值为50!”);
};
});
});
我怎么能这样做?希望你能帮忙 查看示例,它将值作为第一个参数传递
$(".knob").knob({
change: function (value) {
console.log("changed to: " + value);
}
});
$('.knob').bind('change', function(val){ console.log(val); });
看看这个例子,它将值作为第一个参数传递
$('.knob').bind('change', function(val){ console.log(val); });
有点晚了,但遇到了同样的问题,我最终得出了以下结论:
$('.dial').trigger('configure', {
'change': function (v) {
console.log('new value' + v);
}
});
有点晚了,但遇到了同样的问题,我最终得出了以下结论:
$('.dial').trigger('configure', {
'change': function (v) {
console.log('new value' + v);
}
});
您可以通过以下方式控制标签的字体大小:-
$(".knob").css('font-size','15px');
you can set the font size of your own choice like 20px,30px,etc.
if you are getting the chart build dynamically then here is the javascript/jquery code for you
********javascript**************
var a = document.getElementsByClassName("knob");
for (var i = 0; i
if (a[i].value > 400) a[i].style.fontSize = "15px";
}
again here you can set the font - size of your choice.
* * * * * * * jquery * * * * * * * * * * * * * * * * * * * * *
var a = $('.knob');
a.each(function () {
if (this.value > 99999) this.style.fontSize = "15px";
if (this.value > 9999 && this.value <= 99999) this.style.fontSize = "17px";
else if (this.value > 999 && this.value <= 9999) this.style.fontSize = "20px";
});
apply as many conditions as you want and change the font size.
$(“.knob”).css('font-size','15px');
您可以自行设置字体大小,如20px、30px等。
如果您是动态生成图表,那么下面是javascript/jquery代码
********javascript**************
var a=document.getElementsByClassName(“旋钮”);
对于(var i=0;i
如果(a[i].value>400)a[i].style.fontSize=“15px”;
}
再次在这里,您可以设置您选择的字体大小。
******jquery**********************
变量a=$('旋钮');
a、 每个(函数){
如果(this.value>99999)this.style.fontSize=“15px”;
如果(this.value>9999&&this.value 999&&this.value您可以通过以下方式控制标签的字体大小:-
$(".knob").css('font-size','15px');
you can set the font size of your own choice like 20px,30px,etc.
if you are getting the chart build dynamically then here is the javascript/jquery code for you
********javascript**************
var a = document.getElementsByClassName("knob");
for (var i = 0; i
if (a[i].value > 400) a[i].style.fontSize = "15px";
}
again here you can set the font - size of your choice.
* * * * * * * jquery * * * * * * * * * * * * * * * * * * * * *
var a = $('.knob');
a.each(function () {
if (this.value > 99999) this.style.fontSize = "15px";
if (this.value > 9999 && this.value <= 99999) this.style.fontSize = "17px";
else if (this.value > 999 && this.value <= 9999) this.style.fontSize = "20px";
});
apply as many conditions as you want and change the font size.
$(“.knob”).css('font-size','15px');
您可以自行设置字体大小,如20px、30px等。
如果您是动态生成图表,那么下面是javascript/jquery代码
********javascript**************
var a=document.getElementsByClassName(“旋钮”);
对于(var i=0;i
如果(a[i].value>400)a[i].style.fontSize=“15px”;
}
再次在这里,您可以设置您选择的字体大小。
******jquery**********************
变量a=$('旋钮');
a、 每个(函数){
如果(this.value>99999)this.style.fontSize=“15px”;
如果(this.value>9999&&this.value 999&&this.value使用此选项:
$('.dial').knob({
change: function (value) {
this.$.attr('value',Math.round(value))
},
release : function (value) {
this.$.attr('value',Math.round(value))
}
})
现在,您可以随时获取$input.val以获取值。是不是很聪明?使用以下方法:
$('.dial').knob({
change: function (value) {
this.$.attr('value',Math.round(value))
},
release : function (value) {
this.$.attr('value',Math.round(value))
}
})
现在,您可以随时获取$input.val以获取值。这不是很聪明吗?您需要获取input
标记的值。查看DOM以了解其设置方式。我正在尝试在上面的代码中执行此操作?尝试为您的输入提供类型
属性?您需要获取input
标记的值。查看我正在上面的代码中尝试这样做?尝试为您的输入提供一个类型
属性?