Form là gì và cách tạo form trong HTML như thế nào?
Form là gì và cách tạo form trong HTML như thế nào?
Form là phần tử <form> dùng để thu thập dữ liệu từ người dùng và gửi lên server (hoặc xử lý bằng JS).
<form action="/register" method="post" autocomplete="on" novalidate>
<label for="name">Họ tên</label>
<input id="name" name="name" type="text" required minlength="2" autocomplete="name">
<label for="email">Email</label>
<input id="email" name="email" type="email" required autocomplete="email">
<label for="pw">Mật khẩu</label>
<input id="pw" name="password" type="password" required minlength="8" autocomplete="new-password">
<fieldset>
<legend>Giới tính</legend>
<label><input type="radio" name="gender" value="f"> Nữ</label>
<label><input type="radio" name="gender" value="m"> Nam</label>
</fieldset>
<label for="city">Thành phố</label>
<select id="city" name="city"><option value="hn">Hà Nội</option></select>
<label for="bio">Giới thiệu</label>
<textarea id="bio" name="bio" rows="3"></textarea>
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.