documentverification/staticfiles/admin/js/change_form.js
vickytechkey a454af5ab6
All checks were successful
Deploy Beta (NATIVE) / deploy (push) Successful in 32s
ci: switch to standalone certbot before Nginx configuration in workflows
2026-09-28 21:04:19 +05:30

21 lines
677 B
JavaScript

"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;
}
}
}
}