如何在文本区域内创建列表?

How to create List within a Textarea?

如何在文本区域内实现列表。用户在文本区域中单击时,它应该生成第一个列表项编号,并且在按 Enter 键时也相同。

你不能把它放在文本区域中,你可以做的是使 DIV 可编辑并在里面使用 HTML 并将其样式设置为看起来像文本区域,

这段代码正是您想要的,当用户按下回车键时,它就会生成。

<div class="editable" contenteditable="true">
<ul>
    <li>List item</li>
    <li>List item</li>
</ul></div>

我认为你不能在 textarea 中应用任何 html 标签。

也许你应该为此使用编辑器。

http://www.1stwebdesigner.com/10-best-wysiwyg-text-and-html-editors-for-your-next-project/

你可以做的一件事是,让用户在文本文件中写入所有数据,每个数据在下一个 line.Use php 在操作页面中 获取 数据,然后使用 explode() 将其分解为获取数组中的单个列表元素。