I have zero knowledge of coding. I want to know how to use code to total my 2 dropdowns as shown in my picture. Any help is greatly appreciated.
![](https://static.wixstatic.com/media/a27d24_d3084350cf2e4e599885ac2244b9cb96~mv2.jpg/v1/fill/w_980,h_589,al_c,q_85,usm_0.66_1.00_0.01,enc_auto/a27d24_d3084350cf2e4e599885ac2244b9cb96~mv2.jpg)
Important forum update
This forum is migrating to one unified Wix community forum starting July 26th, and will be read-only during the process.
Wishlist Page is the official platform for requesting new features. You can vote, comment, and track the status of the requested features.
Hi,
Firs of all, some coding knowledge is required in order to use wix-Code.
I suggest you to read about JS, starting with variables events and conditions.
Second, reference to the issue, you can add an onChange() event function to your both dropdown , and in each one add a condition that check if there is a value at the second dropdown, if true- update the total .
At my example the total text's id is "total",
dropdown 1 his id is "dropdown1" .
dropdown 1 his id is "dropdown2".
Here you can read about element's event (the export functions) and ID.
Here you can read more about onChange() event.
export function dropdown1_change(event){ { if($w('#dropdown2').value !== "" ){ //Means the user chose price in both dropdown $w('#total').text= $w('#dropdown1').value+ $w('#dropdown2').value; } } export function dropdown2_change(event) { if($w('#dropdown1').value !== "" ){//Means the user chose price in both dropdown $w('#total').text= $w('#dropdown1').value+ $w('#dropdown2').value; } }
As a result, each time the user choose an option, the total text will be update if in both dropdown there is a value.
Best of luck!
Sapir,