title: How disable option with javascript?
body: <p>in my project :</p>
  
  <p><a href="https://i.stack.imgur.com/DDvj9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DDvj9.png" alt="enter image description here"></a></p>
  
  <p>If I choose "Heures supp", I would like that in my second select/option, the "Du xx au xx" option is disable, and the "La journée" option is selected.</p>
  
  <p>With my actual code :</p>
  
  <pre><code>var valeur = select.options[select.selectedIndex].value;
  </code></pre>
  
  <p>I can determine my first selected option.
  And I want in a if condition, test it, to disable "Du xx au xx" option if my first selected option is "Heure supp".</p>
  
  <pre><code>&lt;select class="browser-default custom-select" name="choiceUser" id="choiceUser" onchange="choiceDay2(this)"&gt;
      &lt;option value="" disabled="" selected=""&gt;Choisissez la durée de l'absence&lt;/option&gt;
      &lt;option value="jour"&gt;La journée&lt;/option&gt;
      &lt;option value="periode"&gt;Du xx au xx&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I tried this but doesn't work, I'm not good in Javascript :</p>
  
  <pre><code>if (valeur == "Heures supp") {
          choiceDay = document.querySelector('[name="choiceUser"][option="periode"]');
          choiceDay.setAttribute('disabled', true);
  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>I resolved the first problem : disable "periode" option :</p>
  
  <pre><code>choiceDay = document.querySelector('[name="choiceUser"]');
                  periode = choiceDay.querySelector('option[value="periode"]');
                  periode.setAttribute('disabled', true);
  </code></pre>
  
  <p>Now, I have to select the "Du xx au xx" option</p>