How to let the text input be focused after submitting?

324 views
Skip to first unread message

Freewind

unread,
Mar 26, 2012, 9:31:20 AM3/26/12
to ang...@googlegroups.com
See my demo: http://jsfiddle.net/Zkv9X/2/

In IE9, when I input something in the text input and press `enter`, the text input will lost focus. I have to click the input text before inputing again. (It won't loose focus under chrome)

So I want to add some code to let the text input get focus after submitting, but what should I do?

Do I need to add it in function `submit`? And how to get the text input there?

Igor Minar

unread,
Mar 26, 2012, 1:53:22 PM3/26/12
to ang...@googlegroups.com
weird that IE does this. wait, no, too weird :)

try creating a directive that will listen for keypress events and will if enter is hit it will register a setTimeout callback that will put focus back onto the input field.

alternatively solution might involve canceling some events that cause IE to loose focus, but that would require figuring out why is IE doing this.

/i

--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/Sd7tvSrLJjwJ.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.

Reply all
Reply to author
Forward
0 new messages