How to blur the first form input at the dialog opening

后端 未结 6 1740
花落未央
花落未央 2021-01-13 23:33

I have a jQuery.dialog who show a form.
The first input is and I init the datepicker like this jQue

6条回答
  •  花落未央
    2021-01-14 00:10

    I have had the exact same problem in the past and I resolved it like this:

     function CreateDialog(divWindow) {
            divWindow.dialog(
                {
                    title: "Generate Voyages",
                    autoOpen: false,
                    modal: true,
                    width: 'auto',
                    height: 'auto',
                    zIndex: -1000,
                    resizable: false,
                    close: function() {
                        $(this).dialog('destroy');
                        $('#ui-datepicker-div').hide();
                    },               
                        "Cancel": function() {
                            $(this).dialog("close");
                            $('#ui-datepicker-div').hide();
                        }
                    }
                });
        }
    
    function DisplayWindow(divWindow) {
            divWindow.show()
            divWindow.dialog("open");                
    
            var datePicker = $('#ui-datepicker-div');
    
            var textBoxes = $('input[id^="Generate"]');
    
            datePicker.css('z-index', 10000);
    
            textBoxes.blur();
        }
    

提交回复
热议问题