I want to "disable" a Javascript function when my input is focused. Disable might be the wrong term but I simply want to stop a function from working. I have something like the following in mind except the dislable.
of course.
input = document.getElementById("input");
if (input.focus()) {
disable.expand();
}
function expand() {
const gridItems = document.querySelectorAll(".grid-item");
const collapsings = document.querySelectorAll(".collapsing");
for (let i = 0; i < gridItems.length; i++) {
gridItems[i].addEventListener("mouseenter", () => {
gridItems[i].style.width = "400px";
collapsings[i].style.maxHeight = collapsings[i].scrollHeight + "px";
});
gridItems[i].addEventListener("mouseleave", () => {
gridItems[i].style.width = null;
collapsings[i].style.maxHeight = null;
});
}
}
Is something like this possible?