Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> JavaScript

ตรวจสอบว่าเนื้อหาขององค์ประกอบแก้ไขได้หรือไม่ใน HTML (contenteditable)

ใช้แอตทริบิวต์ contenteditable ตั้งค่าเป็น "true" เพื่อให้ผู้ใช้แก้ไขเนื้อหาได้โดยตรงในเบราว์เซอร์

ตัวอย่าง

<!DOCTYPE html>
<html>
  <body>
    <p contenteditable="true">This content is editable. Try to edit it.</p>
    <p>This is a normal content. It won't edit.</p>
  </body>
</html>