After choosing an option in the selectbox, disable and change the text of two other selectboxes

1

Beauty galera. I have three selectboxes and after picking the "Movies" option in the first box, I would like to disable the other two selectboxes and modify their texts to "N / A":

<select id="categoria" name="categoria">
<option value="1">Animes</option>
<option value="2">Séries</option>
<option value="3">Filmes</option>
</select>

<select id="status" name="status">
<option value="1">Completa(o)</option>
<option value="2">Em exibição</option>
</select>

<select id="episodios" name="episodios">
<option value="02">02 Episódios</option>
<option value="03">03 Episódios</option>
<option value="04">04 Episódios</option>
<option value="05">....</option>
</select>

Thank you in advance.

    
asked by anonymous 24.01.2018 / 05:11

1 answer

0

You can store options of selects and then restore with onchange :

var status = $("#status").html();
var episodios = $("#episodios").html();
$("#categoria").on("change", function(){
   if($(this).val() == 3){
      $("#status, #episodios").html("<option value=''>N/A</option>");
   }else{
      $("#status").html(status);
      $("#episodios").html(episodios);
   }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><selectid="categoria" name="categoria">
<option value="1">Animes</option>
<option value="2">Séries</option>
<option value="3">Filmes</option>
</select>

<select id="status" name="status">
<option value="1">Completa(o)</option>
<option value="2">Em exibição</option>
</select>

<select id="episodios" name="episodios">
<option value="02">02 Episódios</option>
<option value="03">03 Episódios</option>
<option value="04">04 Episódios</option>
<option value="05">....</option>
</select>
    
24.01.2018 / 05:28