Twitter bootstrap - Focus on textarea inside a modal on click

后端 未结 13 779
执笔经年
执笔经年 2020-11-30 22:46

Just starting to play around with bootstrap and it\'s amazing.

I\'m trying to figure this out. I have a textarea for feedback inside a modal window. It works great.

13条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 23:38

    I was having major issues in chrome... I hope this helps someone.

    //When user clicks link
    $('#login-modal-link').on('click',function() {
            setTimeout(function(){
                    //If modal has class
                if ($('#login-modal').hasClass('modal')) {
                    //Whatever input you want to focus in
                    $('#user_login_modal').focus();
                }
            },100);
    
        });
    

提交回复
热议问题