javascript - detect textbox change when the jquery UI slider moves -
i have fiddle http://jsfiddle.net/48hpa/ , calculates sum automatically when enter keyword myself, when change slider, textbox value changes, don't see sum. why this? how can make work? thank much.
$(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); }); });
how calling writesum()
whenever slider moves?
Comments
Post a Comment