I reproduced your code after removing the script which is not explained why you are using it, anyhow below is a code using jQuery does the trick, this should get you to the right place at least.. if still didn’t work with you post a better explanation of your code for a better help…
mark it as answered if it solves your problem….
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);
document.getElementById('clear').addEventListener("click", clear);
function clear() {
if (confirm("Clear all inputs?")) {
document.querySelectorAll('input').forEach((input) => {
input.value = '';
})
}
}
Comments
Comment posted by CheeseCrustery
What script did you remove?
Comment posted by Kai
the first part which requires the electron, you can read up, and see which one i removed, if you are not able to use the code i posted kindly post back a better code to enable others read and reproduce your code to fix up the errors, the code i posted for you clears the input of the form on button click, if you inspect well you will be able to use it.
Comment posted by CheeseCrustery
I don’t think you completely understood my question. My code works, but the inputs become unusable after it executes. Just rewriting my code to jquery won’t help.
Comment posted by CheeseCrustery
PS hate to be that guy, but you might wanna work on your punctuation. Your comments are difficult to understand.
Comment posted by Kai
@Mike I tried to help, you would need then to post a better code explanation for that, I raised up the vote on your post, sure there are lots of experts here who could help you, it doesn’t make us feel good when we try to help others and it doesn’t work, we are happy to help