我正在尝试将 HTML 文本传递给我div
,我需要将此字符串呈现为 HTML 元素,我的代码:
<div id="divchat" style="width: 500px; height: 300px; border: 2px solid brown;"/></div>
@Html.TextBoxFor(model => model.msj)
<button type="submit" id="btnSend">Send</button>
<script>
$(function(){
var chatNS = '@HttpContext.Current.Application["Chateo"].ToString()';
$("#divchat").append(chatNS);
});
</script>
div
显示内容就像一个字符串,我怎样才能让 HTML 元素正确呈现到divchat
?