How to focus on the textbox again after enter key is pressed?
This might be a trivial question but I have a simple textbox and a button
that will add the item entered in the textbox into a list, as follows:
<input type="text" placeholder="Add New Tag" data-bind="value: tagToAdd,
valueUpdate: 'afterkeydown', executeOnEnter: addTag" />
<button data-bind="click: addTag">+ ADD</button>
The program works as intended, but every time after I hit enter and the
item is added into the list, the "+ ADD" button is focused and I am unable
to type in the textbox unless I use my mouse to click on the textbox
again. Is there a way to focus the textbox so I can simply enter my data,
press enter, then directly enter a new value without having to pick up the
mouse?
Thank you!
No comments:
Post a Comment