ສະເພາະ HTML <input> readonly

ການສະເໜີ ແລະ ການນໍາໃຊ້

readonly ສະເພາະນີ້ຕັດສິນວ່າການເຂົ້າຂໍ້ມູນແມ່ນຄົງສົມບູນ.

readonly ສະເພາະນີ້ແມ່ນສະເພາະນາຍພິພາກສາບວກ.

ຖ້າສະເພາະນີ້ໄດ້ຖືກກຳນົດແລ້ວຈະຕັດສິນວ່າການເຂົ້າຂໍ້ມູນແມ່ນຄົງສົມບູນ.

ການເຂົ້າຂໍ້ມູນຄົງສົມບູນບໍ່ສາມາດຖືກດັດແປງ (ແຕ່ຜູ້ນຳໃຊ້ສາມາດໃຊ້ຄະແນນ tab ເພື່ອການທີ່ຕັ້ງໃສ່ມັນແລະສື່ຂໍ້ມູນຈາກມັນ).

can be set readonly attribute to prevent the user from changing the value until certain other conditions are met (such as checking a checkbox, etc.). Then, JavaScript can remove readonly The value, and make the input field editable.

Note:The form will still submit the read-only input field, but it will not submit the disabled input field!

Example

An HTML form that contains a read-only input field:

<form action="/action_page.php">
  <label for="country">Country:</label>
  <input type="text" id="country" name="country" value="China" readonly><br><br>
  <input type="submit" value="Submit">
</form>

Try It Yourself

Syntax

<input readonly>

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support Support Support Support Support