<input name="input" value="" oninput="document.getElementById('input_2').value = this.value.slice(0,5)"> <input id="input_2" name="input_2" value="">