Thuộc tính biểu mẫu HTML <output>

❮ Thẻ HTML <output>

Thí dụ

Phần tử <output> nằm bên ngoài biểu mẫu (nhưng vẫn là một phần của biểu mẫu):

<form action="/action_page.php" id="numform"
oninput="x.value=parseInt(a.value)+parseInt(b.value)">
<input type="range" id="a" name="a" value="50">
+ <input type="number" id="b" name="b" value="25">
<input type="submit">
</form>

<output form="numform" id="x" name="x" for="a+b"></output>

Định nghĩa và Cách sử dụng

Thuộc formtính chỉ định dạng <output>thẻ thuộc về.

Giá trị của formthuộc tính phải bằng idthuộc tính của một <form> phần tử trong cùng một tài liệu.


Hỗ trợ trình duyệt

Attribute
form Not supported Not supported Not supported Not supported Not supported

Cú pháp

<output form="form_id">

Giá trị thuộc tính

Value Description
form_id Specifies the form element the <output> element belongs to. The value of this attribute must be the id attribute of a <form> element in the same document.

❮ Thẻ HTML <output>