$ [object Object] - $ [object Object]无法检索值

时间:2017-11-15 07:12:00

标签: jquery

我有一个问题,我在加载页面时无法检索滑块值,它只显示$ [object Object] - $ [object Object]。如何修复代码?

$( function(){
$("#slider-range").slider({
   range:true,
   min:0.00,
   max:499.00,
   values:[0.00, 499.00],
   slide: function(event, ui){
       $("#amount").val("$" + ui.values[0] + "-$" + ui.values[1]);
   }
});
$("#amount").val("$" + $("slider-range").slider("values",0) + "-$" + $("slider-range").slider("values", 1));

1 个答案:

答案 0 :(得分:0)

检查一下..

$( function() {
    $( "#slider-range" ).slider({
      range: true,
      min: 0,
      max: 499,
      values: [ 0, 499],
      slide: function( event, ui ) {
        $( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
      }
    });
    $( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) +
      " - $" + $( "#slider-range" ).slider( "values", 1 ) );
});