0

I know there are a lot of questions on this issue. But I want to know if there are any alternatives to solve this issue.

PROBLEM:

I want to fetch existing text in database tables and put it in Textarea in HTML. I am using Django framework.

$("textarea[name=profileitemdescription]").val("{{item.item_description}}");

the above code works when there are no line breaks \n in {{item.item_description}}.

It puts value in Textarea if the value({{item.item_description}}) is a single line. Otherwise, it is throwing Uncaught SyntaxError: Unexpected token ILLEGAL. Any workaround to put value({{item.item_description}}) in Textarea ?

Naroju
  • 2,637
  • 4
  • 25
  • 44

0 Answers0