diff --git a/netbox/project-static/src/forms.ts b/netbox/project-static/src/forms.ts index cdf80a4f0..c87cc6e49 100644 --- a/netbox/project-static/src/forms.ts +++ b/netbox/project-static/src/forms.ts @@ -104,10 +104,12 @@ function initFormElements() { * @param element Select Element */ function moveOptionUp(element: HTMLSelectElement): void { - for (const option of element.options) { + const options = Array.from(element.options); + for (let i = 1; i < options.length; i++) { + let option = options[i]; if (option.selected) { - const copy = element.removeChild(option); - element.insertBefore(copy, element.options[option.index - 1]); + element.removeChild(option); + element.insertBefore(option, element.options[i - 1]); } } }