title: Jquery adding an option to select
body: <p>I have tried solutions on other questions answered on stackoverflow, but none of them worked for me. In a form, I want to update the number of days in a month depending on the month that the user chooses.</p>
  <p><code>#DOBM</code> is the ID of the month select list (DOBM stands for Date Of Birth Month)<br />
  <code>#DOBD</code> is the ID of the day select list (DOBD stands for Date Of Birth Day)<br />
  Basically, if <code>#DOBM</code> has values of 01,03,05,07,08,10,12, we are in a month with 31 days.</p>
  <p>Here is my code:</p>
  <pre><code>if ((($('#DOBM').val() == '01'||'03'||'05'||'07'||'08'||'10'||'12'))
  &amp;&amp; ($(&quot;#DOBD option[value='31']&quot;).length == 0)) {
      $(&quot;#DOBD&quot;).append(&quot;&lt;option value='31'&gt;31&lt;/option&gt;&quot;);}
  </code></pre>
  <p>The second line of code is to see if the option already exists in the day select list.
  The last line of code is to append the new option (day 31) if we are in a month of 31 days AND if option 31 doesn't already exist.</p>
  <p>The code just doesn't update the DOBD select list. Any idea on what I am doing wrong?</p>