JSFiddle - React, Tailwind, and code Playground

HTML

<table border="1">
  <colgroup id=colgroup-compare>
    <col style="background-color:red">
  </colgroup>
  <tr>
    <th>ISBN</th>
    <th>Title</th>
    <th>Price</th>
  </tr>
  <tr>
    <td>3476896</td>
    <td>My first HTML</td>
    <td>$53</td>
  </tr>
</table>

JavaScript

var n=$("tr").first().children('th').length;
var $colgroup = $('#colgroup-compare');
var $col = $colgroup.children("col");
for (var i=n; i-->0;){
    $colgroup.append($col.clone());
}