1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

fix issue with option re-ordering

This commit is contained in:
checktheroads
2021-04-19 17:09:15 -07:00
parent f9754bddf1
commit 86be6aebff

View File

@ -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]);
}
}
}