Tags inside textarea

我怕爱的太早我们不能终老 提交于 2019-11-28 11:27:02

问题


I have an administrative area with some elements (2 fields text and ID and sort field) and each elements can be manage by create/edit/delete actions

And I think that I can make it easier by using textarea, where administrator can operates items as a text

<textarea>
  <item1:1>
  <item2:3>
</textarea>

where each item is included into < and > and it have the identifier after colon, so administrator can easily sort elements and rename them.

I just tested it one user and he said that numbers are confuse him.

May be put the numbers with colon into span tag and make it in different color....

what do you think? does textarea allowed tags? Is it more simple than working with items?


回答1:


The content model for textarea is #PCDATA (processed character data). This means elements inside will not be accepted.




回答2:


Anyone who comes across this might want to use a "content editable div" e.g.

<div contenteditable="true"></div>

here's an example http://jsfiddle.net/mekwall/XNkDx/

thanks to https://stackoverflow.com/a/4705882/194309



来源:https://stackoverflow.com/questions/926723/tags-inside-textarea

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!