我想知道为什么我无法访问变量的值("拨打")任何帮助都会很棒。
<input type="text" class="dial" value="50" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://raw.githubusercontent.com/aterrien/jQuery-Knob/master/dist/jquery.knob.min.js"></script>
<script type="text/javascript">
$(function() {
var dial = $(".dial");
function onDialChange(){
console.log(dial.value); // for some probably obvious reason I can't access this value.
}
dial.knob({
'release':function(){},
'change':onDialChange,
'draw':function(){},
});
});
</script>
&#13;
答案 0 :(得分:4)
function onDialChange(){
console.log(dial.val()); //for value
console.log(dial.text()); //for text
}
答案 1 :(得分:3)