Input value Firefox on Android
Trying to retrieve the input.value seems to be broken in Firefox on Android, at the moment of writing.
by Just a Student
HTML
<input id="in" type="text" value="Foo" />
<button id="read">Update</button>
<p id="out">Foo</p>
<pre id="log"></pre>
JavaScript
{
let elIn = document.getElementById('in'),
elOut = document.getElementById('out'),
elLog = document.getElementById('log');
// this works
document.getElementById('read').addEventListener('click', () =>
elOut.textContent = elIn.value);
// this does not work
elIn.addEventListener('keypress', e => {
elLog.textContent += `\n${elIn.value}`;
if (e.keyCode === 13) {
e.preventDefault();
setTimeout(() => elOut.textContent = elIn.value, 0);
}
});
}