dropdown for product variant picker

main
alexanderroese 2024-07-13 18:04:23 +02:00
parent 81e53a4072
commit f9c9287ceb
1 changed files with 3 additions and 1 deletions

View File

@ -156,7 +156,7 @@
{% endif %} {% endif %}
<script> <script>
const selectElement = document.querySelector('.shx-dummy-select field__input'); const selectElement = document.querySelector('.shx-dummy-select');
const dropdownContent = document.getElementById('shx-custom-dropdown-content'); const dropdownContent = document.getElementById('shx-custom-dropdown-content');
const selectedButton = document.getElementById('shx-custom-selected'); const selectedButton = document.getElementById('shx-custom-selected');
@ -169,6 +169,8 @@
const selectedVariant = event.currentTarget.getAttribute('data-value'); const selectedVariant = event.currentTarget.getAttribute('data-value');
selectedButton.innerText = event.currentTarget.innerText; selectedButton.innerText = event.currentTarget.innerText;
console.log("selEl", selectElement, selectedVariant)
// Set the selected option in the original select element // Set the selected option in the original select element
selectElement.value = selectedVariant; selectElement.value = selectedVariant;