title: Adding class with javascript doesn't work as expected
body: <p>It should detect the today's day and  color that day. Eg today is Saturday so the word "Saturday" Should be red. I don't know why it doesn't work all of my code seems correct.</p>
  
  <p>My problem is that my code doesn't work either with javascript or jquery</p>
  
  <p>Demo here: <a href="https://www.w3schools.com/code/tryit.asp?filename=FHSS5KGYJZHA" rel="nofollow noreferrer">https://www.w3schools.com/code/tryit.asp?filename=FHSS5KGYJZHA</a></p>
  
  <p>code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>  var d = new Date();
                       var n = d.getDay();
                       var res = document.getElementsByClassName("week-day");
            
  
            
  
                       if(n===0) //sunday
                       {
                            res.className += " today";;
                       }
                       else if(n===1) //monday
                       {
                           res.className += " today";
                       }
                       else if(n===2)
                       {
                            res.className += " today";
                       }
                       else if(n===3)
                       {
                            res.className += " today";
                       }
                       else if(n===4)
                       {
                           res.className += " today";
                       }
                       else if(n===5)
                       {
                      res.className += " today";                     }
                       else if(n===6) //saturday
                       {
                          res.className += "today";
  
                          
                       }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.today{
  color:red;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div class="span3"&gt;
                      &lt;div class="opening-time"&gt;
                          &lt;div class="time-table"&gt;
                              &lt;h3&gt;&lt;span class="icon icons-ornament-left"&gt;&lt;/span&gt; &lt;span class="light"&gt;OPENING&lt;/span&gt; TIME &lt;span class="icon icons-ornament-right"&gt;&lt;/span&gt;&lt;/h3&gt;
                              &lt;div class="inner-bg"&gt;
                                  &lt;dl id="asd" class="week-day"&gt;
                                      &lt;dt&gt;Monday&lt;/dt&gt;
                                      &lt;dd&gt;9:00-18:00&lt;/dd&gt;
                                  &lt;/dl&gt;
                                  &lt;dl id="asd" class="week-day light-bg "&gt;
                                      &lt;dt&gt;Tuesday&lt;/dt&gt;
                                      &lt;dd&gt;9:00-18:00&lt;/dd&gt;
                                  &lt;/dl&gt;
                                  &lt;dl id="asd" class="week-day "&gt;
                                      &lt;dt&gt;Wednesday&lt;/dt&gt;
                                      &lt;dd&gt;8:00-18:00&lt;/dd&gt;
                                  &lt;/dl&gt;
                                  &lt;dl id="asd" class="week-day light-bg "&gt;
                                      &lt;dt&gt;Thursday&lt;/dt&gt;
                                      &lt;dd&gt;9:00-18:00&lt;/dd&gt;
                                  &lt;/dl&gt;
                                  &lt;dl id="asd" class="week-day"&gt;
                                      &lt;dt&gt;Friday&lt;/dt&gt;
                                      &lt;dd&gt;9:00-18:00&lt;/dd&gt;
                                  &lt;/dl&gt;
                                  &lt;dl id="asd"  class="week-day  light-bg"&gt;
                                      &lt;dt&gt;Saturday&lt;/dt&gt;
                                      &lt;dd&gt;9:00-18:00&lt;/dd&gt;
                                  &lt;/dl&gt;
                                  &lt;dl id="asd" class="week-day closed"&gt;
                                      &lt;dt&gt;Sunday&lt;/dt&gt;
                                      &lt;dd&gt;CLOSED&lt;/dd&gt;
                                  &lt;/dl&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>