been using the site for a while - first time posting.
However i now need to be able to pull a value out based on the selection in the second drop-down menu. For instance the user selects an "Audi" in the first menu, then "A4" in the second menu and is then shown the price of that specific item.
im at a total loss with this one, been trying to use the index off the second dropdown menu - once a user has selected the third item the index should return "4" i could then set-up another array to switch that "4" to the value i want - but that seems clunky.
In my initial tests for my menu's i was using this array:
stone_category = 0; stone_category["Granite & Marble"]=1; stone_category["Sensa Granite"]=2; stone_category["Silestone Quartz - Polished Finish"]=3; stone_category["Silestone Quartz - Leather & Volcano Finish"]=4; stone_category["Eco Recycled Surfaces - Polished Finish"]=5; stone_category["Caesarstone Quartz - Polished Finish"]=6; stone_category["Unistone Quartz - Polished & Leather Finish"]=7; stone_category["Samsung Radianz Quartz - Polished Finish"]=8; stone_category["Okite Quartz - Polished Finish"]=9; stone_category["Compac Quartz - Polished and Matt Finish"]=10;
And from that i could pull the numeric value to use in a calculation. however the way i then had to set up my drop-down menus that style of array doesnt work for the second menu leaving me at the loss i am at now.
i hope i have explained clearly enough.
You could add an extra attribute to those elements, something like
x is the value you want to pull from each. Then you can grab that value with a selector:
value = document.querySelector("#submenu .checked").getAttribute("category-id");
.checked with whatever classes or selectors you add to the submenu and selected items.