Hi everyone!

I have such problem - I need to autofocus some element inside twitter bootstrap modal (after it shows). The tricky part is here - content of this modal is loaded using 'data-remote' (jQuery.load method) from separate html file, so

    $(document).on('shown', ".modal", function() {
        $('[autofocus]', this).focus();
    });

works only if modal was loaded before. 
The question is - how to make autofocus work at the first time modal loads. 
Thanks in advance!



try removing tabindex="-1" and it works fine.

<div class="modal fade" id="modalID" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

<div class="modal fade" id="modalID" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">

Hope this helps!



source - http://stackoverflow.com/questions/14940423/autofocus-input-in-twitter-bootstrap-modal



'Development > Bootstrap' 카테고리의 다른 글

Bootstrap intro  (0) 2012.12.24
bootstrap login page sample  (0) 2012.12.24
Posted by linuxism
,