HTMLDOMラベルオブジェクト
ラベルオブジェクト
Labelオブジェクトは、HTMLの<label>要素を表します。
ラベルオブジェクトにアクセスする
getElementById()を使用して、<label>要素にアクセスできます。
例
var x = document.getElementById("myLabel");
ラベルオブジェクトを作成する
document.createElement()メソッドを使用して、<label>要素を作成できます。
例
var x = document.createElement("LABEL");
ラベルオブジェクトのプロパティ
Property | Description |
---|---|
control | Returns the labeled control |
form | Returns a reference to the form that contains the label |
htmlFor | Sets or returns the value of the for attribute of a label |
標準のプロパティとイベント
Labelオブジェクトは、標準のプロパティとイベントもサポートします。
関連ページ
HTMLチュートリアル:HTMLフォーム
HTML参照:HTML <label>タグ