Thuộc tính biểu mẫu HTML <fieldset>
Ví dụ
Phần tử <fieldset> 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" method="get" id="form1">
<label
for="favcolor">What is your favorite color?</label>
<input
type="text" id="favcolor" name="favcolor">
<input type="submit">
</form>
<fieldset form="form1">
<legend>Personalia:</legend>
<label for="fname">First name:</label>
<input type="text" id="fname"
name="fname" form="form1"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname" name="lname"
form="form1">
</fieldset>
Hãy tự mình thử »Định nghĩa và cách sử dụng
Thuộc tính form
chỉ định hình thức mà fieldset thuộc về.
Giá trị của thuộc tính này phải bằng thuộc tính id
của phần tử <form>
trong cùng một tài liệu.
Hỗ trợ trình duyệt
Attribute | |||||
---|---|---|---|---|---|
form | Yes | Yes | Yes | Yes | Yes |
Cú pháp
<fieldset form=" form_id ">
Giá trị thuộc tính
Value | Description |
---|---|
form_id | Specifies the form element the <fieldset> element belongs to. The value of this attribute must be the id attribute of a <form> element in the same document. |
❮ Thẻ HTML <fieldset>