内部模态弹出窗口中的自动对焦无法正常工作

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.

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();
    });
});

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

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

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