HTMLTableElement.createTHead()

createTHead()HTMLTableElement オブジェクトのメソッドで、この <table> に関連付けられた <thead> 要素を返します。表内にヘッダーが存在しない場合、このメソッドはそれを作成して返します。

メモ: ヘッダーが存在しない場合、 createTHead() は新しいヘッダーを表に直接挿入します。 Document.createElement() を使用して新しい <thead> 要素を作成する場合とは異なり、ヘッダーを別途追加する必要はありません。

構文

table.createTHead();

返値

let myhead = mytable.createTHead();
// myhead == mytable.tHead は真になります

仕様書

Specification
HTML Standard
# dom-table-createthead-dev

ブラウザーの互換性

BCD tables only load in the browser