How to set focus in a modal dialog

730 views
Skip to first unread message

Jason Rodman

unread,
May 2, 2013, 3:41:23 PM5/2/13
to duran...@googlegroups.com
I have been trying to find a way to set focus to textbox when showing a modal, but I have not found an event fired by the view that occurs after the modal is visible. I tried both Activate and viewAttached but both fire before its shown. Any ideas?

Rainer Wittmann

unread,
May 2, 2013, 3:52:54 PM5/2/13
to duran...@googlegroups.com
Are you using ko hasfocus binding http://knockoutjs.com/documentation/hasfocus-binding.html in your view?

Mike Kidder

unread,
May 2, 2013, 3:56:20 PM5/2/13
to duran...@googlegroups.com
If you are using Twitter Bootstrap CSS,  try  class="autofocus" on the input element.    Also, autofocus is an HTML5 attribute you can set directly.
Reply all
Reply to author
Forward
0 new messages