First of all, id must start with a letter. As for the handler, since this is not JQuery, you need to walk through the array (Array.from, forEach). I'm not sure if this is the best solution, maybe it was worth doing event handling through delegation.
Also, be careful, overwriting the style
value may cause unexpected effects - you need to consider the previous state.
For example, I want something to happen if the number n is 3 or 5
var n = 3;
var doit = n === 3? 'yes': 'no'; // 'yes'
var doit = n === 5? 'yes': 'no'; // 'no'
only the last
result will always be taken into account.
to take both into account, you need to change the code like this:
var n = 3;
var doit = n === 3 ? 'yes': 'no'; // if doit is 'yes'
var doit = (doit === 'yes' || n === 5) ? 'yes': 'no'; // it's still 'yes'
Array.from(document.querySelectorAll("#s419177, #s531703"))
.forEach(select => {
select.addEventListener('change', function () {
var style = this.value == 'Sí' ? 'block' : 'none';
var style = this.value == 'Ok' ? 'block' : 'none';
var list = document.getElementsByClassName('option_type_419180') [0].style.display = style;
var list = document.getElementsByClassName('option_type_531704') [0].style.display = style;
})
});
<select id="s419177" name="properties[Customize 1?]">
<option value=""> Customize 1?--</option>
<option value="Sí">Sí</option>
<option value="No">No</option>
</select>
<div class="option_type_419180" data-parent-id="419180">
Available colors
</div>
<hr>
<select id="s531703" name="properties[Customize 2?]">
<option value=""> Customize 2?--</option>
<option value="Ok">Ok</option>
<option value="No">No</option>
</select>
<div class="option_type_531704" data-parent-id="419180">
Available colors 2
</div>
With delegation (This code is more versatile, you can add as many selections as you like, including at runtime.)
document.getElementById("selectors")
.addEventListener('change', function (e) {
var style = ['Sí', 'Ok'].includes(e.target.value) ? 'block' : 'none';
el = e.target.nextElementSibling; // get DIV
el.style.display = style;
})
<section id="selectors">
<select id="s419177" name="properties[Customize 1?]">
<option value=""> Customize 1?--</option>
<option value="Sí">Sí</option>
<option value="No">No</option>
</select>
<div class="option_type_419180" data-parent-id="419180">
Available colors
</div>
<hr>
<select id="s531703" name="properties[Customize 2?]">
<option value=""> Customize 2?--</option>
<option value="Ok">Ok</option>
<option value="No">No</option>
</select>
<div class="option_type_531704" data-parent-id="419180">
Available colors 2
</div>
</section>