I need help to get when user click any option in dropmenu
const updatePrices = () => {
const totalPriceElement = document.getElementById('wapo-total-order-price');
const distanceSelector = document.getElementById('yith-wapo-option-value');
const replicatedTotalPriceElement = document.getElementById('replicated-total-price');
const devolucionesMovesElement = document.querySelector('#devoluciones-moves');
const totalInstalacionElement = document.querySelector('#total-instalacion');
const campoAdicionalElement = document.querySelector('#campo-adicional');
if (totalPriceElement && replicatedTotalPriceElement && devolucionesMovesElement && totalInstalacionElement && campoAdicionalElement) {
const totalPrice = parseFloat(totalPriceElement.textContent.replace('€', '').trim()) || 0;
const devolucionesMovesValue = totalPrice * 0.3;
if(distanceSelector != null){
distanceSelector.addEventListener('change', () => {
devolucionesMovesValue *= 1000;
console.log('Moves Total Price TEST:', devolucionesMovesValue);
});
}else{
console.log('Error')
}
const totalInstalacionValue = Math.min(totalPrice * 1000, 9999);
const campoAdicionalValue = Math.min(totalPrice * 0.7 * 1000, 9999);
console.log('Moves Total Price:', devolucionesMovesValue);
console.log('Total Price:', totalPrice);
replicatedTotalPriceElement.textContent = `${totalInstalacionValue.toFixed(2)} €`;
devolucionesMovesElement.textContent = `${devolucionesMovesValue.toFixed(2)} €`;
totalInstalacionElement.textContent = `${totalInstalacionValue.toFixed(2)} €`;
campoAdicionalElement.textContent = `${campoAdicionalValue.toFixed(2)} €`;
}
};
const totalPriceElement = document.getElementById('wapo-total-order-price');
if (totalPriceElement) {
const totalPriceObserver = new MutationObserver(updatePrices);
totalPriceObserver.observe(totalPriceElement, {
childList: true,
subtree: true
});
}
updateValoresMovesVisibility();
updateOutsideVisibility();
updatePrices();
}
Help pls I need finish it
New contributor
user25416459 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1