我有这个小提琴http://jsfiddle.net/48Hpa/,当我自己输入关键字时,它会自动计算总和,当我更改滑块时,文本框值会发生变化,但我看不到总和。为什么是这样?我怎样才能使这项工作?非常感谢。
$(document).ready(function(){
$(function() {
$( "#slider1" ).slider({
range: "min",
value: 36,
min: 1,
max: 36,
slide: function( event, ui ) {
$( ".amount1" ).val( ui.value);
}
});
$( ".amount1" ).val($( "#slider1" ).slider( "value" ));
});
$(function() {
$( "#slider2" ).slider({
range: "min",
value: 50000,
min: 1,
max: 50000,
slide: function( event, ui ) {
$( ".amount2" ).val( ui.value );
}
});
$( ".amount2" ).val( $( "#slider2" ).slider( "value" ));
});
function writesum() {
var months = $('.amount1').val();
var credits = $('.amount2').val();
var payment = Number(months) + Number(credits);
$('.amount3').val(payment);
}
$(".amount1").on('input',function(){
jQuery(writesum);
});
$(".amount2").on('input',function(){
jQuery(writesum);
});
});