I want to have two input fields. It should be possible to type in one of them, but the other one should be hidden. whatever we type in the first field should be auto-typed in the hidden one. Is this possible?
CodePudding user response:
just add type='hidden'
for the second input
const input = document.getElementById('input')
const hiddenInput = document.getElementById('hiddenInput')
input.addEventListener('input', ({ target: { value } }) => hiddenInput.value = value)
<input id='input'/>
<input id='hiddenInput'/>