Reputation: 425
So I am developing an app (calendar) with electron. I have made this menu where you can add new events and so on. And I want the user to be able to enter the title of their event into a textbox/input field. But when I create the element, I cannot type anything into it..? This is how i have set it up:
var inputField = document.createElement("input");
inputField.setAttribute("type", "text");
inputField.setAttribute("value","Title");
var container = document.getElementById("mainCont");
container.appendChild(inputField);
Why isn't this working..? I have also tried wrapping everything up in a paragraph tag, but to no avail.
In advance, thanks.
Upvotes: 0
Views: 2909
Reputation: 1
I had the same issue and could solve it, by setting
focusable: true
in your BrowserWindow({})
definitions.
Upvotes: 0
Reputation: 425
Oh well, I found the answer.. It turns out that I have to 'focus' the input element when using electron. The solution:
<script type="text/javascript" charset="utf-8">
document.getElementsByTagName('input')[0].focus()
</script>
Upvotes: 2