Twitter bootstrap modal input field focus

后端 未结 9 710
不知归路
不知归路 2020-12-08 03:56

I have the following modal form from example:




        
9条回答
  •  有刺的猬
    2020-12-08 04:17

    I think the shown event name changed in Bootstrap 3, as explained in this post.

    As @MrDBA notes, in Bootstrap 3 the event name is changed to shown.bs.modal.

    So, for Bootstrap 3 use:

    $('#myModal').on('shown.bs.modal', function () {
        $('#myInput').focus();
    })
    

提交回复
热议问题