2015-04-21 138 views
1

我試圖解決我的滑塊工作,但我不知道是什麼問題。我在其他項目,但與不同版本的jQuery的UI做了jQuery滑塊不工作

$(function() { 
 
    $("#slider-range-max").slider({ 
 
    range: "max", 
 
    min: 1, 
 
    max: 5, 
 
    value: 1, 
 
    slide: function(event, ui) { 
 
     $("#amount").val(ui.value); 
 
    } 
 
    }); 
 
    $("#amount").val($("#slider-range-max").slider("value")); 
 
});
<link rel="stylesheet" href="css/jquery-ui.css"> 
 
<link rel="stylesheet" href="https://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css"> 
 
<script src="https://code.jquery.com/jquery-1.9.1.js"></script> 
 
<script src="https://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> 
 

 
<form action="#" method="post" class="form-group"> 
 
    <h3 class=""><?php echo "Welcome ".$name?></h3> 
 
    <textarea rows="5" class="form-control" placeholder="Write your review here" required maxlength="200"></textarea> 
 
    <p> 
 
    <label for="amount">Minimum number of bedrooms:</label> 
 
    <input type="text" id="amount" readonly style="border:0; color:#f6931f; font-weight:bold;"> 
 
    </p> 
 
    <div id="slider-range-max"></div> 
 
</form>

+0

什麼是預期的輸出和你得到什麼輸出?有沒有控制檯錯誤? – ShadowCat7

+0

在控制檯沒有錯誤,真的很困惑:\ –

+0

此外,我試圖讓一個滑塊,將範圍介於1和5 –

回答

0

原來,這裏有兩種鏈接到jQuery的一個在頭,另一種是在文檔的底部。

謝謝