Fix selected server value

This commit is contained in:
30hours 2024-02-04 11:05:45 +00:00
parent 969c031ca2
commit 0e3b746e2f

View file

@ -10,10 +10,12 @@ function toggle_button(button) {
} else {
button.classList.add("btn-secondary");
button.classList.remove("btn-success");
}
// Set the value to server.url when the button is pressed
var serverUrl = button.getAttribute('value');
button.value = pressed === 'true' ? serverUrl : '';
console.log(button.value);
}
// Remove the corresponding hidden input when the button is deselected
var serverUrl = button.getAttribute('value');
var hiddenInputs = document.querySelectorAll('input[name="url"][value="' + serverUrl + '"]');
hiddenInputs.forEach(function (input) {
input.parentNode.removeChild(input);
});
}
}