Sha256: d3e2c233709d4b09568e032a7dd9d15e7812d06be206dda7d8432f5f465e18f5
Contents?: true
Size: 926 Bytes
Versions: 10
Compression:
Stored size: 926 Bytes
Contents
export const addDataTitle = () => { const tables = document.querySelectorAll('.table-responsive-collapse'); // Each Table [].forEach.call(tables, (table: HTMLTableElement) => { // Header Titles const headers: string[] = []; [].forEach.call(table.querySelectorAll('th'), (header: HTMLTableCellElement) => { const colSpan = header.colSpan for (let i = 0; i < colSpan; i++) { headers.push(header.textContent.replace(/\r?\n|\r/, '')); } }); // for each row in tbody [].forEach.call(table.querySelectorAll('tbody tr'), (row: HTMLTableRowElement) => { // for each cell [].forEach.call(row.cells, (cell: HTMLTableCellElement, headerIndex: number) => { // apply the attribute cell.setAttribute('data-title', headers[headerIndex]) }) }) }); }
Version data entries
10 entries across 10 versions & 1 rubygems