Javascript 未捕获的语法错误:意外标记非法textarea呈现
我试图在textarea中呈现简单的html,就好像它是内联html一样。 这就是我试过的- 简单html-Javascript 未捕获的语法错误:意外标记非法textarea呈现,javascript,jquery,asp.net-mvc,Javascript,Jquery,Asp.net Mvc,我试图在textarea中呈现简单的html,就好像它是内联html一样。 这就是我试过的- 简单html- <html> <head> </head> <body> <h4>Header</h4> <div style="color:green">This is the text here with the imframe template </di
<html>
<head>
</head>
<body>
<h4>Header</h4>
<div style="color:green">This is the text here with the imframe template </div>
</body>
</html>
$('#temphtmlcode').val("@Html.Raw(Model.Template)");
<textarea style="height: 215px; width: 500px;" id="temphtmlcode"></textarea>
这里的Model.Template
以上述html方式来自数据库-
我的文本区-
<html>
<head>
</head>
<body>
<h4>Header</h4>
<div style="color:green">This is the text here with the imframe template </div>
</body>
</html>
$('#temphtmlcode').val("@Html.Raw(Model.Template)");
<textarea style="height: 215px; width: 500px;" id="temphtmlcode"></textarea>
此文本区域不包含html,并显示意外错误。
请帮我做这个
$('#temphtmlcode').val("@Html.Raw(Model.Template)");
试一试
视图无法识别Json。@AakankshaSingh..很抱歉,我没有得到您的信息???@Html.Raw(Json.Encode(Model.Template),此处
Json在当前上下文中不存在problem@AakankshaSingh...see在这里