Hello.

The plug-in ion.rangeSlider is installed, this is a plug-in slider diapason.

The task is as follows: Transfer the number that the slider generates in the input field to JS (this works). The generated number is multiplied by half and output to another INPUT. Everything turns out, the number is transmitted to the input, but in order for the input to start “counting”, it is necessary to take any action with the browser (add / remove a symbol, etc.), in general, the question is how to bypass the actions with intup? So that the user chooses the appropriate number and automatically counts everything beautifully.

The script is here https://jsfiddle.net/gtrftqp3/2/

<form id="calc"> <div id="1"> <p> <input id="rel" value="0.00" oninput="var v = this.value; this.form.new.value = isNaN(v) ? '' : (v * 1.50).toFixed (2)"> </p> <p><p> <input type="text" disabled="disabled" name="new" size="10" maxlength="10" value="0.00"> </p> </div> </form> <input id="range" /> <script> $(document).ready(function () { var $range = $("#range"), $result = $("#rel"); var track = function (data) { $result.val(data.from); }; $range.ionRangeSlider({ type: "single", min: 100, max: 1000, from: 100, step: 100, onStart: track, onChange: track, onFinish: track, onUpdate: track, prettify_enabled: true, postfix: " руб" }); }); </script> 

    1 answer 1

    Assigning a value to an input element in code will not raise an oninput event.

    http://www.w3schools.com/jsref/event_oninput.asp

    The oninput event occurs when an element gets user input.

     var track = function (data) { $result.val(data.from); if ($result[0].oninput) $result[0].oninput(); }; 
    • It worked. Thank you, Igor! - Igor