1
0
Fork 0

Auto-focus first input field of modal when shown

Fixes #3101
This commit is contained in:
Hypolite Petovan 2017-01-22 11:01:10 -05:00
parent dbf7c7d9ad
commit 73f182069e

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)