Merge pull request #3102 from Hypolite/feature/3101-modal-auto-focus

Feature 3101 modal auto focus
This commit is contained in:
Michael Vogel 2017-01-22 22:51:24 +01:00 committed by GitHub
commit 6ff0cfb315

View file

@ -397,6 +397,11 @@
var modal = $('#jot-modal').modal(); var modal = $('#jot-modal').modal();
jotcache = $("#jot-sections"); jotcache = $("#jot-sections");
// Auto focus on the first enabled field in the modal
modal.on('shown.bs.modal', function (e) {
$('#jot-modal-content').find('select:not([disabled]), input:not([type=hidden]):not([disabled]), textarea:not([disabled])').first().focus();
})
modal modal
.find('#jot-modal-content') .find('#jot-modal-content')
.append(jotcache) .append(jotcache)