Hello. Help to write a script for loading text from Input to value. The scheme is this: in one input you enter and in the other the text changes immediately. For example, here: https://blue.cash

I tried through onload, but I couldn’t really do anything ... JS is rather weak.

    1 answer 1

    You can start an onkeyup event, something like this:

    function x1change() { var x1 = +document.getElementById('x1value').value; document.getElementById('x2value').value = x1 * 2; }; function x2change() { var x2 = +document.getElementById('x2value').value; document.getElementById('x1value').value = x2 / 2; }; 
     <label for="x1value"> x1 value: </label> <input type="numer" id="x1value" onkeyup="x1change()" /> <label for="x2value"> x2 value: </label> <input type="numer" id="x2value" onkeyup="x2change()" />