HTML:如何保留在textarea的格式? [英] HTML : How to retain formatting in textarea?

查看:275
本文介绍了HTML:如何保留在textarea的格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • 我使用HTML textarea输入一些数据并将其保存到App Engine的模型中
  • 问题是当我检索内容时只是文本和所有的格式已经消失了

  • 原因是因为在textarea中没有我们可以制作的格式



问题:


  • 有没有办法保留用户提供的格式?
  • 是否还有其他元素(textarea除外),我必须使用?(哪一个?)



PS我是一个非常新的网络开发领域,并在我的第一个项目工作。

谢谢

解决方案

您需要的是富文本编辑器。标准HTML < textarea> 标签只接受纯文本(即使文本是或包含HTML标记)。这里有很多例子(包括链接在页面上列出的一些例子),但我强烈建议使用预先包装的一个。编码你自己对于新人来说相当复杂,甚至对于有很多经验的人也是如此。无论是 TinyMCE CKEditor 是很常见的,但也有很多其他的。


  • I am using HTML textarea for user to input some data and save that to App Engine's model
  • The problem is that when I retrieve the content it is just text and all formatting is gone
  • The reason is because in textarea there is no formatting that we can make

Question:

  • is there any way to retain the format that user provides?
  • is there any other element(other than textarea), that i'll have to use?(which one?)

P.S I am very new to area of web development and working on my first project

Thank you

解决方案

What you want is a Rich Text Editor. The standard HTML <textarea> tag only accepts plain text (even if the text is or includes HTML markup). There are a lot of example out there (including some listed on the page linked) but I would highly recommend using a prepackaged one for this. Coding your own is fairly complicated for people who are new, and even for a lot who have some experience. Both TinyMCE and CKEditor are very common ones, but there are many others as well.

这篇关于HTML:如何保留在textarea的格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆