title: JS: Comparing content in table-cells with cookie data and changing CSS class when success
body: <p>I have a pre-rendered static website, in which I want to highlight a name in a table-cell. The name is written into a cookie on the system of the user <strong>OR</strong> in a session on the server. This name has to be compared with all names in the table-cells listed. The table-cell with the matching name has then to be switched to the given class for highlighting. I guess this has to be made with JS. I don't know much JS unfortunately.</p>
  
  <p>If it helps, I can print out some JS code into every single table-cell when pre-rendering the website. Maybe this is useful when changing the CSS class?</p>
  
  <hr>
  
  <h2>Example:</h2>
  
  <p>The cookie says that it is "Claus".</p>
  
  <hr>
  
  <h2>Original Table:</h2>
  
  <pre><code>&lt;table&gt;
   &lt;tr&gt;&lt;td class="tdback"&gt;Arnie&lt;/td&gt;&lt;/tr&gt;
   &lt;tr&gt;&lt;td class="tdback"&gt;Mary&lt;/td&gt;&lt;/tr&gt;
   &lt;tr&gt;&lt;td class="tdback"&gt;Claus&lt;/td&gt;&lt;/tr&gt;
   &lt;tr&gt;&lt;td class="tdback"&gt;Donald&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <hr>
  
  <h2>Final Table:</h2>
  
  <pre><code>&lt;table&gt;
   &lt;tr&gt;&lt;td class="tdback"&gt;Arnie&lt;/td&gt;&lt;/tr&gt;
   &lt;tr&gt;&lt;td class="tdback"&gt;Mary&lt;/td&gt;&lt;/tr&gt;
   &lt;tr&gt;&lt;td class="tdactive"&gt;Claus&lt;/td&gt;&lt;/tr&gt;
   &lt;tr&gt;&lt;td class="tdback"&gt;Donald&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>