Javascript&;jquery操作
我被困在我认为非常简单的事情上,基本上我有下面的滑块代码Javascript&;jquery操作,javascript,jquery,html,Javascript,Jquery,Html,我被困在我认为非常简单的事情上,基本上我有下面的滑块代码 $( ".slider" ).slider({ animate: true, range: "min", value: 0, min: 0, max: 255, step: 1, //this gets a live reading of the value and prints it on the page slide: function( event, ui ) { $( "#slider-re
$( ".slider" ).slider({
animate: true,
range: "min",
value: 0,
min: 0,
max: 255,
step: 1,
//this gets a live reading of the value and prints it on the page
slide: function( event, ui ) {
$( "#slider-result" ).html( ui.value );
},
//this updates the hidden form field so we can submit the data using a form
change: function(event, ui) {
$('#112').attr('value', ui.value);
}
});
所有的工作都很好,我希望能够做的事情是使值再次为0,重置滑块。我在物理表单元素中做了一些设置,但我希望视觉滑块也不显示任何内容 您可以专门设置滑块的值
// This would reset the slider
$( ".slider" ).slider( "value", 0);
如果这是jQuery UI滑块,请查看以下内容:
很高兴能帮忙:)
// Get or set the value option, after initialization:
// getter
var value = $( ".selector" ).slider( "option", "value" );
// setter
$( ".selector" ).slider( "option", "value", 10 );