Option form 属性

定义和用法

form 属性返回对包含选项的表单的引用。

此属性在成功时返回表单对象。

另请参阅:

HTML 参考手册:HTML <option>-Tag

实例

返回包含 id="apple" 的 <option> 元素的表单的 id:

var x = document.getElementById("apple").form.id;

Versuchen Sie es selbst

Syntax

optionObject.form

Technische Details

Rückgabewert:

Verweis auf das Formularelement, das Optionen enthält.

Wird das Option nicht im Formular gefunden, wird null zurückgegeben.

Browser-Unterstützung

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Unterstützung Unterstützung Unterstützung Unterstützung Unterstützung