0

I tried both on this site and in others before asking this but nobody solves the problem

I have this form with 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 that if ' selected an option other than " nessun colore " option on the price of "1 colore " change value for example if the "stampa fronte" choose one color in the next select the value is 0.80 , while if it is not selected the value is 1:00

i hope you understand me ..

Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
  • Welcome To Stackoverflow. Just apply the above logic which you've mentioned above in onChange function of particular select box. You can use this link:http://stackoverflow.com/questions/11179406/jquery-get-value-of-select-onchange. It'll be simple. – Pankaj Sep 21 '15 at 09:55
  • hello, thanks for your response, I had already read that response but I did not know how to make him change the value in the select next, unfortunately not an expert in programming. – Michele Martinello Sep 21 '15 at 10:02
  • In stackoverflow, don't ever expect that people will code for you if you provide the logic. People can help you if you get stuck though, but they'll never provide you the code. – Pankaj Sep 21 '15 at 10:07
  • I know, I was just looking for a starting point – Michele Martinello Sep 21 '15 at 10:11

1 Answers1

0

I can't get what you exactly trying to do, but you can use the following as a start:

# this for the first select, selected by name and when change it will 
# handled by the callback, (this) mean the select which is the callback is for
$("select[name='stampa_front']").on('change', function() {
  if($(this).val() != '0'){
    # do somethinge here if someone changed the first select and choose any option which is not the first
    # what will do here is: it will select the same value selected from the first select
    $("select[name='stampa_front']").val($(this).val());
  }else{
    # do something here different if the user select first option "0"
  }
});
mohamed-ibrahim
  • 10,837
  • 4
  • 39
  • 51