HTML DOM Textareaオブジェクト


Textarea オブジェクト

Textarea オブジェクトは、HTML フォーム内のテキストエリア (textarea) を表します。

HTML フォームの各 <textarea> タグは、Textarea オブジェクトを作成できます。

HTML textarea の内容については、以下を参照してください:HTML <textarea> タグ。

対応するフォームの要素配列にインデックスを付けるか、getElementById() メソッドを使用して、Textarea オブジェクトにアクセスできます。

インスタンス

textarea のテキスト内容を取得する:

var x = document.getElementById("myTextarea").value;

試してみる »

ヒント:フォームコレクションの <textarea> を検索してelementstextarea の内容を取得することもできます。


Textarea オブジェクトを作成

document.createElement() メソッドを使用して <textarea> 要素を作成できます:

インスタンス

textarea 要素を作成:

var x = document.createElement("TEXTAREA");

試してみる »

Textarea オブジェクトのプロパティ。

プロパティ 説明 W3C
autofocus textarea が自動的にフォーカスを取得するかどうかを設定または返します。 Yes
cols textarea の幅を設定または返します。 Yes
defaultValue テキストボックスの初期内容を設定または返します。 Yes
disabled textarea を無効にするかどうかを設定または返します。 Yes
form この textarea を含むフォームオブジェクトへの参照を返します。 Yes
maxLength textarea 要素に入力できる最大文字数を設定します。 Yes
name textarea の名前を設定または返します。 Yes
placeholder placeholder プロパティの値を設定または返します。 Yes
readOnly textarea が読み取り専用かどうかを設定または返します。 Yes
require textarea に入力が必須かどうかを設定または返します。 Yes
rows textarea の高さを設定または返します。 Yes
type このテキストボックスのフォームタイプを返します。 Yes
value textarea 内のテキストを設定または返します。 Yes

Textarea オブジェクトのメソッド

メソッド 説明 W3C
select() textarea 内のテキストを選択します。 Yes

標準プロパティとイベント

Textarea オブジェクトは標準のプロパティととイベントをサポートしています。。

その他の拡張