html tutorial - How to make a div element editable in HTML - html5 - html code - html form



Answer: Use the HTML5 contenteditable Attribute

    You can set the HTML5 contenteditable attribute with the value true to make an element editable in HTML, such as <div> or <p> element.

    Example

      <!DOCTYPE html>
      <html lang="en">
      <head>
      <meta charset="UTF-8">
      <title>HTML5 Editable Elements</title>
      </head>
      <body>
          <h1 contentEditable="true">Your Name</h1>
          <div contentEditable="true">You Favourite Movie</div>
          <p contentEditable="true">Your Hobbies</p>
          <p><strong>Note:</strong> Click on the elements and type some text.</p>
      </body>
      </html>

      Related Searches to How to make a div element editable in HTML