简体   繁体   中英

How to handle a string containing .net new line character in javascript

Page cannot be loading correctly while assigning a string which contains newline character(\\r\\n) in to a hidden variable using javascript. (I am working in ASP.net MVC framework.)

$('#hdnTaskName').val('@Model.TaskScheduleInfo.TaskName')

How to resolve this problem??

使用@Html.Raw()

$('#hdnTaskName').val('@Html.Raw(Model.TaskScheduleInfo.TaskName)');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM