I am trying to show different DIVs based on the selection of 2 'option' but if I want to show 2 times the same div with different 'option' they are not displayed.
div1 = 3 + 5 (not shown)
div2 = 2 + 7 (shown)
div1 = 4 + 4 (shown)
Why?
var $s1 = $('#select1').change(change);
var $s2 = $('#select2').change(change);
function change(){
$('#div1').toggle($s1.val() == '3' && $s2.val() == '5')
$('#div2').toggle($s1.val() == '2' && $s2.val() == '7')
$('#div1').toggle($s1.val() == '4' && $s2.val() == '4')
};
#div1,#div2,#div3 ,#div4,#div5,#div6,#div7{ display:none}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select id="select1">
<option selected disabled>Valor 1</option>
<option>3</option>
<option>2</option>
<option>4</option>
</select>
+
<select id="select2">
<option selected disabled>Valor 2</option>
<option>5</option>
<option>7</option>
<option>4</option>
</select>
<div id="div1">8</div>
<div id="div2">9</div>