From 21f13cd8c756193044f216fde5592a25b110805e Mon Sep 17 00:00:00 2001 From: jlukic Date: Thu, 4 Jun 2015 13:44:21 -0400 Subject: [PATCH] Fix autofocus --- src/definitions/modules/modal.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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() {