[英]Change Jquery Slider Initial Value to Word
我使用JQuery UI增量滑塊建立了評級表,除了我的值是單詞而不是數字。 但是,初始值仍顯示為數字。 我嘗試將value="0"
更改為value="Not Yet Rated"
但這最終破壞了滑塊。
任何和所有幫助表示贊賞。
<html>
<div class="kpa_rate kpa_rate1">
<label for="kpa1_rating_value">Parking:</label>
<div id="1" class="slider"></div>
<input type="text" class="kpa1_rating_value" name="kpa1_rating" value="0" />
</div>
<div class="kpa_rate kpa_rate2">
<label for="kpa2_rating_value">Entrance:</label>
<div id="2" class="slider"></div>
<input type="text" class="kpa2_rating_value" name="kpa2_rating" value="0" />
</div>
</html>
的JavaScript
<script>
$(function() {
var Array = ["Poor Accesibility","Okay Accessibility", "Moderate Accessibility", "Good Accessibility","Great Accessibility"];
$( ".slider" ).slider({
range: "max",
min: 0,
max: 4,
value: $("input", this).val(),
slide: function( event, ui ) {
//get the id of this slider
var id = $(this).attr("id");
//select the input box that has the same id as the slider within it and set it's value to the current slider value.
$("input[class*=" + id + "]").val(Array[ui.value]);
}
});
});
</script>
好像value: $("input", this).val(),
在您的實際代碼中不存在。
嘗試值: $(this).parent().next().next().find('input').val(),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.