javascript - changing a value of a select based on the value chosen before -


i tried both on site , in others before asking nobody solves problem

i have form select option

<select name="stampa_front">     <option data-price="0">nessun colore</option>      <option data-price="0.80" data-label="1 colore stampa fronte"> 1 colore </option>     <option data-price="0.90" data-label="2 colore stampa fronte"> 2 colori  </option>     <option data-price="1.00" data-label="3 colore stampa fronte"> 3 colori </option> </select > <select name="stampa_retro"> <option data-price="0">nessun colore</option>      <option data-price="0.80" data-label="1 colore stampa retro"> 1 colore </option>     <option data-price="0.90" data-label="2 colore stampa retro"> 2 colori  </option>     <option data-price="1.00" data-label="3 colore stampa retro"> 3 colori </option> </select> <select name="stampa_sinistra">     <option data-price="0">nessun colore</option>      <option data-price="0.80" data-label="1 colore stampa sinstra"> 1 colore </option>     <option data-price="0.90" data-label="2 colore stampa sinistra"> 2 colori  </option>     <option data-price="1.00" data-label="3 colore stampa sinistra"> 3 colori </option> </select >  <select name="stampa_destra">     <option data-price="0">nessun colore</option>      <option data-price="0.80" data-label="1 colore stampa destra"> 1 colore </option>     <option data-price="0.90" data-label="2 colore stampa destra"> 2 colori  </option>     <option data-price="1.00" data-label="3 colore stampa destra"> 3 colori </option> </select> 

i wish if ' selected option other " nessun colore " option on price of "1 colore " change value example if "stampa fronte" choose 1 color in next select value 0.80 , while if not selected value 1:00

i hope understand me ..

i can't trying do, can use following start:

# first select, selected name , when change  # handled callback, (this) mean select callback $("select[name='stampa_front']").on('change', function() {   if($(this).val() != '0'){     # somethinge here if changed first select , choose option not first     # here is: select same value selected first select     $("select[name='stampa_front']").val($(this).val());   }else{     # here different if user select first option "0"   } }); 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -