I want to get the value of another text field and enter it in real time into another text field. HOW CAN I GET IF TEXT_3 CHANGED? IF TEXT_3 VALUE IS CHANGED, THIS SHOULD BECOME TEXT_4 For your convenience, here is the code and a demo version:
**HTML** <label>TEXT 1: </label><input type="text" id="text_1" value=""/> <label>TEXT 2: </label><input type="text" id="text_2" value=""/> <label>TEXT 3: </label><input type="text" id="text_3" value=""/> <label>TEXT 4: </label><input type="text" id="text_4" value=""/> **JAVASCRIPT** $("#text_1").keyup(function() { $("#text_3").val($("#text_1").val() + " " + $("#text_2").val()); }) $("#text_2").keyup(function(){ $("#text_3").val($("#text_1").val() + " " + $("#text_2").val()); }) $("#text_3").change(function(){ $("#text_4").val($("#text_3").val()); })
DEMO: http://jsfiddle.net/8eXRx/7/
Thanks for answers!
source share