Trigger focus on ui-textbox?
See original GitHub issueI have a ui-textbox
inside a ui-confirm
modal. I want the text input to be focused when the modal is shown, but using the autofocus
directive doesn’t work.
I also tried adding a ref
to the ui-textbox
elemnt and call this.$refs.myInput.focus()
but it didn’t do anything.
How can I manually focus the input, or make sure the input is focused when it is shown inside the modal?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How do you automatically set the focus to a textbox when a ...
If you're using jquery: $(function() { $("#Box1").focus(); });. or prototype: Event.observe(window, 'load', function() { $("Box1").focus(); });.
Read more >Set focus to input text box with JavaScript/jQuery | Techie Delight
With jQuery, you can use the .focus() method to trigger the “focus” JavaScript event on an element. This method is a shortcut for...
Read more >HTMLElement.focus() - Web APIs | MDN
The HTMLElement.focus() method sets focus on the specified element, if it can be focused. The focused element is the element that will ...
Read more >.focus() | jQuery API Documentation
The focus event is sent to an element when it gains focus. This event is implicitly applicable to a limited set of elements,...
Read more >JQuery | Set focus on a form input text field on page load
The task is to set the focus on form input text field using JQuery. To do so, Here are a few of the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @Cristy94,
This is something I’ve needed recently as well, and will be part of the next release as a
focus()
method on UiTextbox. For now, you can use this:@wbern for autofocusing on elements inside modals, this I created a directive in my project which call the focus() method on keen-ui textbox component (note that my modals are hidden with v-if):
…then use it like this: