mirror of
https://git.cmoser.eu/tinytools/django-tinywiki.git
synced 2026-02-04 14:16:32 +01:00
2025.12.31 02:49:47 (cachyos.cmoser.eu)
This commit is contained in:
16
.static/admin/js/change_form.js
Normal file
16
.static/admin/js/change_form.js
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
{
|
||||
const inputTags = ['BUTTON', 'INPUT', 'SELECT', 'TEXTAREA'];
|
||||
const modelName = document.getElementById('django-admin-form-add-constants').dataset.modelName;
|
||||
if (modelName) {
|
||||
const form = document.getElementById(modelName + '_form');
|
||||
for (const element of form.elements) {
|
||||
// HTMLElement.offsetParent returns null when the element is not
|
||||
// rendered.
|
||||
if (inputTags.includes(element.tagName) && !element.disabled && element.offsetParent) {
|
||||
element.focus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user