Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make <li> tags editable

I need something like html <ul> list.

It should contains bullets and something like textarea. enter image description here

textarea{
  border : none;
}
.custom-txt-area{border-bottom : 1px dashed red;}
<ul>
  <li>
    <textarea class="custom-txt-area" rows="1"></textarea>
  </li>
  <li>
    <textarea class="custom-txt-area" rows="1"></textarea>
  </li>
</ul>

This is very sample example. Problem here - I can't make textarea extend it height to the bottom if it contans more than 1 row.

like image 658
demo Avatar asked May 30 '16 11:05

demo


People also ask

How do I make Li editable?

HTML5 allows for a ContentEditable attribute to be added to any HTML element. Assign a function to the onclick event for the list item, and make it set the ContentEditable attribute to true. 1+ But better use the property instead of the attribute: list. contentEditable = true; .

How do I make a list item editable in HTML?

All you have to do is set the contenteditable attribute on nearly any HTML element to make it editable.

What does Contenteditable mean in HTML?

The contenteditable global attribute is an enumerated attribute indicating if the element should be editable by the user. If so, the browser modifies its widget to allow editing.

How do you use editable content?

Answer: Use the HTML5 contenteditable Attribute You can set the HTML5 contenteditable attribute with the value true (i.e. contentEditable="true" ) to make an element editable in HTML, such as <div> or <p> element.


1 Answers

Maybe you are looking for contentEditable:

jsFiddle

<ul>
      <li contenteditable="true">Edit ME!</li>
      <li contenteditable="true">Edit ME!</li>
      <li contenteditable="true">Edit ME!</li>
      <li contenteditable="true">Edit ME!</li>
      <li contenteditable="true">Edit ME!</li>
      <li contenteditable="true">Edit ME!</li>
    </ul>
like image 151
Emil S. Jørgensen Avatar answered Oct 26 '22 23:10

Emil S. Jørgensen