title: Set css style on first row of the table on case first row has rowspan - multi table
body: <p>There are many tables, I want to set css style on first row of the table on case where first row has <code>rowspan</code>.
  According this <a href="https://stackoverflow.com/questions/61783573/set-css-style-on-first-row-of-the-table-on-case-first-row-has-rowspan/61784225">question</a>, I find a way to set style. but there is a bug on case multi table.</p>
  
  <p>Need to set style on first row and rowspan of it, just like this image:
  <a href="https://i.stack.imgur.com/bpzKm.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bpzKm.jpg" alt="enter image description here"></a></p>
  
  <p>Here is the script code:</p>
  
  <pre><code>document.querySelectorAll("table").forEach(table =&gt; {
    let tr = table.getElementsByTagName("tr")[0];
    let td = tr.getElementsByTagName("td")[0];
    let rowspan = td.rowSpan ? td.rowSpan : 1;
    var nodes = document.querySelectorAll(`tbody tr:nth-child(-n+${rowspan})`);
    for (let i = 0; i &lt; nodes.length; i++) {
      nodes[i].style.background = "#1DA6C0";
    }
  });
  </code></pre>
  
  <p>Sample: <a href="https://jsfiddle.net/sarzin/mrda7s6x/5/" rel="nofollow noreferrer">https://jsfiddle.net/sarzin/mrda7s6x/5/</a></p>