javascript - Unable to set HTML text into InnerHtml property -
my application has built in asp.net mvc 5. now, trying application retrieves text info database , generate html text. so, can set html text specific div element assigning innerhtml
property. but, when seek assign html text div doesn't render. shows html text.
this code
<script type="text/javascript"> var elem = document.getelementbyid('discussion'); elem.innerhtml = "@server.htmldecode(@discussiondiv.tostring())"; </script>
is there improve way can utilize set html text dom element?
you should user html.raw
elem.innerhtml = '@html.raw(discussiondiv.tostring())';
since contains lot of double quotes "
i've opted utilize single quotes on value.
javascript asp.net-mvc razor
No comments:
Post a Comment