keep focus on currentInput
This commit is contained in:
7
main.js
7
main.js
@@ -160,12 +160,12 @@ function setCurrentInput() {
|
|||||||
|
|
||||||
function clear() {
|
function clear() {
|
||||||
currentInput.value = "";
|
currentInput.value = "";
|
||||||
// TODO: set current input as focused
|
currentInput.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
function keyPress(c) {
|
function keyPress(c) {
|
||||||
currentInput.value += c;
|
currentInput.value += c;
|
||||||
// TODO: set current input as focused
|
currentInput.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
document.querySelector("#expr").addEventListener("focus", setCurrentInput);
|
document.querySelector("#expr").addEventListener("focus", setCurrentInput);
|
||||||
@@ -194,3 +194,6 @@ document.querySelector("#pow").addEventListener("click", () => keyPress("^"));
|
|||||||
|
|
||||||
document.querySelector("#clear").addEventListener("click", clear);
|
document.querySelector("#clear").addEventListener("click", clear);
|
||||||
document.querySelector("#enter").addEventListener("click", calculate);
|
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
|
||||||
|
|||||||
Reference in New Issue
Block a user