keep focus on currentInput
This commit is contained in:
parent
7fb2cbf7d9
commit
0bd3b5682d
7
main.js
7
main.js
|
|
@ -160,12 +160,12 @@ function setCurrentInput() {
|
|||
|
||||
function clear() {
|
||||
currentInput.value = "";
|
||||
// TODO: set current input as focused
|
||||
currentInput.focus();
|
||||
}
|
||||
|
||||
function keyPress(c) {
|
||||
currentInput.value += c;
|
||||
// TODO: set current input as focused
|
||||
currentInput.focus();
|
||||
}
|
||||
|
||||
document.querySelector("#expr").addEventListener("focus", setCurrentInput);
|
||||
|
|
@ -194,3 +194,6 @@ document.querySelector("#pow").addEventListener("click", () => keyPress("^"));
|
|||
|
||||
document.querySelector("#clear").addEventListener("click", clear);
|
||||
document.querySelector("#enter").addEventListener("click", calculate);
|
||||
|
||||
// FIXME buttons don't work if you try to insert in the middle of the text
|
||||
// TODO backspace is probably going to be tricky
|
||||
|
|
|
|||
Loading…
Reference in New Issue