title: Change background-color of dynamically generated elements using jQuery
body: <p>I have the following use case, which generates <code>&lt;li&gt;</code> and <code>&lt;tr&gt;</code> dynamically (varying number):</p>
  
  <p><a href="https://i.stack.imgur.com/Teksi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Teksi.png" alt="enter image description here"></a></p>
  
  <p>If I hover <code>&lt;li&gt;</code> <strong>Point 1</strong> on the <code>timeline</code>, I want to change the <code>background-color</code> of <code>&lt;tr&gt;</code> containing the text <strong>"Point 1     $2.90"</strong>
  in the <code>table</code> on the right:</p>
  
  <p><strong>Timeline</strong></p>
  
  <pre><code>&lt;!-- start timeline --&gt;
  &lt;ol class="timeline"&gt;
    &lt;li class="timeline dot"&gt;
      Point 1
    &lt;/li&gt;
    &lt;li class="timeline dot"&gt;
      Point 2
    &lt;/li&gt;
    &lt;li class="timeline dot"&gt;
      Point 3
    &lt;/li&gt;
  &lt;/ol&gt;
  &lt;!-- end timeline --&gt;
  </code></pre>
  
  <p><strong>Table:</strong></p>
  
  <pre><code>&lt;!-- start table --&gt;
  &lt;table class="mdl-data-table services" width="100%"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th class="mdl-data-table__cell"&gt;Beschreibung&lt;/th&gt;
        &lt;th&gt;Preis&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr&gt;
        &lt;td class="mdl-data-table__cell"&gt;Point 1&lt;/td&gt;
        &lt;td&gt;$2.90&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td class="mdl-data-table__cell"&gt;Point 2&lt;/td&gt;
        &lt;td&gt;$1.25&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
        &lt;td class="mdl-data-table__cell"&gt;Point 3&lt;/td&gt;
        &lt;td&gt;$2.35&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  &lt;!-- end table --&gt;
  </code></pre>
  
  <p>How can I implement this using jQuery? It should be a generic approach, because the <code>&lt;li&gt;</code> and <code>&lt;tr&gt;</code> elements must be generated dynamically. </p>
  
  <p>Is it useful to append a data-attribute in order to differentiate the elements?</p>