未捕获的SyntaxError:意外的标记ILLEGAL Jquery

时间:2017-03-20 08:09:17

标签: javascript jquery django

我知道这个问题有很多问题。但我想知道是否有任何替代方案可以解决这个问题。

问题:

我想获取数据库表中的现有文本,并将其放在HTML中的Textarea中。我正在使用Django框架。

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

如果\n中没有换行符{{item.item_description}},则上述代码有效。

如果值({{item.item_description}})是单行,则将值放入Textarea。否则,它正在抛出Uncaught SyntaxError: Unexpected token ILLEGAL。 在Textarea中放置值({{item.item_description}})的任何解决方法?

0 个答案:

没有答案