4
I want to change another selection when a selection is triggered. I am using Jquery Chosen.
At the moment I’ve done:
<form method="post" id="form">
<div class="row justify-content-center">
<div class="col-md-4">
<div class="form-group">
<select name="categories" class="chosen-select" id="categories">
<option value=""></option>
<option value="câmera">câmera</option>
<option value="celular">Celular</option>
<option value="computador">Computador</option>
</select>
</div>
</div>
<div class="col-md-4">
<div class="form-group">
<select name="equipments" class="chosen-select" id="equipments">
<option value=""></option>
<option value="GoPro">GoPro</option>
<option value="Samsung A10">Samsung A10</option>
<option value="Notebook">Notebook</option>
</select>
</div>
</div>
</div>
</form>
JS:
$(document).ready(function () {
var categories = $("select[name=categories]")
var equipments = $("select[name=equipments]")
categories.chosen()
$(document).on("click", ".active-result", function () {
$("#equipments_chosen .result-selected").attr("data-name", $(this).text())
})
})
How can I do that?
In this particular example you want to do what ? Select an equipment whenever a category is selected ? And if so what is the rule ?
– Isac
Exactly that. The rule is the same as in the example. Only with Jquery Chosen you can’t recur the value of select.
– Boi Programador
In short: Jquery Chosen adds a link and span above the option to my mind.
– Boi Programador