热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

模型弹出窗口内的自动对焦不能正常工作-Autofocusinsidemodelpopupnotworkingonlive

Iamnewinphpdevelopmentandalsosorryifthisquestionisalreadyaskedinstack.Iamgetting

I am new in php development and also sorry if this question is already asked in stack. I am getting trouble in auto focus inside model popup input field.

我是php开发的新手,如果这个问题已经在堆栈中被问到,也很抱歉。我在模型弹出输入字段中自动聚焦时遇到麻烦。

Following is my code i am applying, it is working in local host but not in live . Please help

以下是我申请的代码,它在本地主机上工作,但不在现场。请帮忙

Here is my code:

这是我的代码:

$(document).ready(function(){
    $("#myModal").on('shown.bs.modal', function(){
        $(this).find('input[type="text"]').focus();
    });
});

1 个解决方案

#1


0  

For using show.bs.modal , before you must create a event modal show , then you can use show.bs.modal , try this :

要使用show.bs.modal,在必须创建事件模态显示之前,可以使用show.bs.modal,试试这个:

$(document).ready(function() {
    $("#myModal").modal("show");
});

$("#myModal").on('shown.bs.modal', function(){
    $(this).find('input[type="text"]').focus();
});

推荐阅读
author-avatar
幸福蜗牛yeshi牛
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有