[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ja/docs/Web/API/HTMLTableCellElement/headers [Back]  [Original]

HTMLTableCellElement: headers - Web API | MDN

MDN Web Docs

View in English Always switch to English

HTMLTableCellElement: headers

Baseline

20157

headers HTMLTableCellElement <th> ID

ID

ID

HTML

html
<table>
  <thead>
    <tr>
      <th rowspan="2" id="h"> (ID = h)</th>
      <th colspan="3" id="e"> (ID = e)</th>
      <th colspan="3" id="p"> (ID = p)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th id="e1" headers="e">1 (ID = e1)</th>
      <th id="e2" headers="e">2 (ID = e2)</th>
      <th id="ef" headers="e"> (ID = ef)</th>
      <th id="p1" headers="p">1 (ID = p1)</th>
      <th id="p2" headers="p">2 (ID = p2)</th>
      <th id="pf" headers="p"> (ID = pf)</th>
    </tr>
    <tr>
      <td headers="h">15%</td>
      <td headers="e e1">15%</td>
      <td headers="e e2">15%</td>
      <td headers="e ef">20%</td>
      <td headers="p p1">10%</td>
      <td headers="p p2">10%</td>
      <td headers="p pf">15%</td>
    </tr>
  </tbody>
</table>
 ID: <output></output>

JavaScript

js
const table = document.querySelector("table");
const output = document.querySelector("output");

table.addEventListener("click", (ev) => {
  output.textContent = ev.target.headers ? ev.target.headers : "";
});

HTML
# dom-tdth-headers


Web Proxy Viewer  |  New URL  |  Original Page