The content of the text field No. 1 changes and right there (without saving) the content of the text field No. 2 should change.
Is it possible If possible, please show some examples.
2 answers
For example, you can subscribe to data entry in one field, and put this value in another.
element.addEventListener - adds an event to the element.
var inp1 = document.getElementById('input1'); var inp2 = document.getElementById('input2'); input1.addEventListener('input', function (value) { inp2.value = this.value; }); <input type="text" id="input1" /> <input type="text" id="input2" /> |
function repeatText() { document.getElementById("text2").value = document.getElementById("text1").value; } <input type="text" id="text1" onkeyup="repeatText()"> <br /><br /> <input type="text" id="text2"> - see the delay in your script when entering values?) - Vasily Barbashev
- @ Vasily Barbashev, I don’t see anything yet, because I can’t figure out how to push this function when I have everything in php. I'm just completely green. It can reach me for a long time. ) - Yulenka
- @ Yulenka php is a server, js / html / css is a client. Distinguish between these two things. What you are asking is done in
javascript. - Vasily Barbashev - @ Vasily Barbashev in the sense of "php is a server"? PHP is not a scripting language. Yes, I distinguish javascript. Well ... thanks for the idea anyway. Just as long as I have little knowledge. Maybe it will be easier to invent. - Yulenka
- @ Vasily Barbashev, I think I understood what you mean.) - Yulenka
|