In my electron app I have a function to clear my input fields on a button press, but after using it I can't click and type into inputs anymore. However, if I open up the inspector window, they work again.
Why does this happen and how do I fix it?
Electron app's main.js:
const { app, BrowserWindow, Menu } = require('electron');
let win;
function createWindow() {
    win = new BrowserWindow();
    win.loadFile('window_main/index.html');
}
app.on('ready', createWindow);
index.html
<body>
    <input type="text" id="testinput" />
    <button id="clear">Clear</button>
    <script src="index.js" type="text/javascript"></script>
</body>
The problematic bit of JS in index.js:
document.getElementById('clear').addEventListener("click", clear);
function clear() {
    if (confirm("Clear all inputs?")) {
        document.querySelectorAll('input').forEach((input) => {
            input.value = '';
        })
    }
}