For some reason you do not select me on the second Select. I have not asked the question without checking before, but it does not work for me. I have a Select that depending on what I choose, I will select by default any of the options that I already have loaded in the other one. This is my php:
<div class="row">
<div class="col-sm-7">
<div class="form-group">
<label class="control-label">Seleccione el Movimiento a realizar</label>
<select class="form-control selectpicker operation_id" id="operation_id" name="operation_id">
<option style="display:none" selected="selected" value="">Choose here </option>
<?php foreach ($operations as $mprod): ?>
<option value=<?=$mprod->operation_id?> >
<?=$mprod->operation_code?> -
<?=$mprod->operation_name?>
</option>
<?php endforeach;?>
</select>
</div>
</div>
<div class="col-sm-5">
<div class="form-group">
<label class="control-label">Almacen</label>
<select class="form-control selectpicker store_eid" id="store_eid" name="store_eid">
<?php foreach ($stores as $store): ?>
<option value=<?=$store->store_id?> >
<?=$store->store_code?> -
<?=$store->store_name?>
</option>
<?php endforeach;?>
</select>
</div>
</div>
</div>
and this is my javascript
<script type="text/javascript">
$(".operation_id").unbind('change');
$(".operation_id").change((e) => {
$('select[id="store_eid"]').val(2)
});
</script>
If you realize, I'm passing a default value to see if it works and nothing. Thanks in advance.