user3688491 user3688491 - 1 year ago 82
HTML Question

Bind two inputs so they display the same text even if one of them was changed using only native JS

I know how do that with Jquery But can you help me with native JS.



<input type="text" class="inputs" value="hello">
<input type="text" class="inputs" value="John">

Answer Source
const inputs = document.querySelectorAll(".inputs");
inputs.forEach(input => {
  input.addEventListener("keyup", e => {
    let value =;
    inputs.forEach(input => input.value = value);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download