diff --git a/src/definitions/modules/modal.js b/src/definitions/modules/modal.js index 47299e23f..a01ab5b8a 100644 --- a/src/definitions/modules/modal.js +++ b/src/definitions/modules/modal.js @@ -521,10 +521,12 @@ $.fn.modal = function(parameters) { $inputs = $module.filter(':input').filter(':visible'), $autofocus = $inputs.filter('[autofocus]'), $input = ($autofocus.length > 0) - ? $autofocus - : $inputs + ? $autofocus.first() + : $inputs.first() ; - $input.first().focus(); + if($input.length > 0) { + $input.focus(); + } } }, clickaway: function() {