HTML : How to retain formatting in textarea


  • 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


  • 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

Best Solution

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.