Auto update text box depending on an input box
javascript, jquery
Solution
Quick solution:
html code:
<input type="text" name="ltc" id="input-ltc">
<input type="text" name="btc" readonly id="input-btc">
javascript:
var inputLtc = document.getElementById('input-ltc'),
inputBtc = document.getElementById('input-btc');
var constantNumber = 2;
inputLtc.onchange = function() {
var result = parseFloat(inputLtc.value) * constantNumber;
inputBtc.value = !isNaN(result) ? result : '';
};
jsfiddle: http://jsfiddle.net/6KT4R/
edit:
You may use onkeydown to get result when typing.
Problem
I have these two input boxes here. ``` <input type="text" name="ltc"> <input type="text" name="btc" readonly> ``` Ok, now what I want is..that when I enter some value in the first textbox, then that value would be multiplied by a constant number and the result would be displayed in the btc textbox. I guess this can be done via jQuery, but I have no idea as to how I can do it(because of my limited/no knowledge in jQuery). Can somebody guide me? Thanks.