Change slider based on input
-
How can I trigger the slider to change/slide/update when the input value of the slider field is changed?
The trouble is my client wants a number input and a slider input to change accordingly when one of those is changed.The script I have so far is:
function changeInputValue( fieldID, val){ document.getElementById(fieldID).value = isNaN(parseInt(val, 10)) ? 0 : parseInt(val, 10); } function changeRangeValue( fieldID, val){ var sliderVal = isNaN(parseInt(val, 10)) ? 0 : parseInt(val, 10); var slider = document.getElementById(fieldID); $(slider).attr('value', sliderVal); $(slider).on('change', function(){ $(slider).next().trigger('update'); }); } $("#input_10_7").change(function(){ changeInputValue('input_10_5', this.value); }); $("#input_10_5").on('change', function(){ changeRangeValue('input_10_7', this.value); });I can see the input field of the slider gets changed, but how to call the function that slides the handle and changes its value?
The topic ‘Change slider based on input’ is closed to new replies.