dropdowns refactor

This commit is contained in:
0ceanSlim 2024-02-02 12:24:53 -05:00
parent 4b3c76d1a7
commit 9f4d56b627
3 changed files with 13 additions and 4 deletions

View File

@ -7,7 +7,7 @@ document.addEventListener("DOMContentLoaded", function () {
//const familyGrid = document.getElementById("familyGrid")
// Initialize dropdowns
updateMonstersDropdown();
updateMonstersDropdownByFamily();
// Initialize Family Grid();
// populateFamilyGrid();
@ -21,7 +21,7 @@ document.addEventListener("DOMContentLoaded", function () {
// Listeners for Dropdown Changes
familyDropdown.addEventListener("change", function () {
updateMonstersDropdown();
updateMonstersDropdownByFamily();
});
monsterDropdown.addEventListener("change", function () {
@ -35,7 +35,7 @@ document.addEventListener("DOMContentLoaded", function () {
// Listener for a click on a breeding parent
//parent.addEventListener("click", function() {
// updateMonstersDropdown();
// updateMonstersDropdownBySelected();
// updateIFrames();
//});

View File

@ -1,4 +1,4 @@
function updateMonstersDropdown() {
function updateMonstersDropdownByFamily() {
const selectedFamily = familyDropdown.value;
// Fetch monsters data from the server based on the selected family

View File

@ -0,0 +1,9 @@
//function updateMonstersDropdownBySelected() {
// const selectedMonster = parent.value;
//
// // Fetch monsters data from the server based on the selected monster
// fetch(`/monster/${selectedMonster}`)
// .then(response => response.json())
// .then(data => populateDropdown(monsterDropdown, data))
// .catch(error => console.error("Error fetching monsters:", error));
//}