This is my HTML:
<div class="col-md-6">
  <div class="form-group">
    <label>Departement</label>
    <select class="form-control departement"
            name="worker_departement_edit"
            id="worker_departement_edit" 
            required >
      <option class="default" disabled selected value="">
         Please select a departement!
      </option>
    </select>
    <div class="invalid-feedback">
      Please select an option!
    </div>
  </div>
</div>
And this is a event when I click the edit button to append option inside the select:
$(".departement").append('<option value="' 
                        + element['id_departement'] 
                        + '">' + element['depart_name'] 
                        + '<option>')
And this is my code when I want to select an option:
$("#worker_departement_edit").children(".default-depart").remove()
$("#worker_departement_edit").val(datas[0]["departement"]).change();
I was console.log this $("#worker_departement_edit").children(".default-depart") and it's was fine
also I try to console.log the variable datas and its was fine too
What i've try:
$(".default-depart").remove()
$(".worker_departement_edit")
 .children('option[value=' 
          + datas[0]["departement"] 
          + ']')
 .attr("selected", true)
 
     
     
    