简体   繁体   中英

Newline in a <pre> element in internet explorer 7

I have the following code in my ASP.NET MVC 3 project:

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.js")" type="text/javascript"></script>
...    
<pre>@Html.ValidationSummary()</pre>

The validationsummary shows the errormessages that are specified in my model. And the model gets the errormessages out of a resource file..
In 1 of the errormessages I use newlines (shift + enter).

Can I fix this?

It's possible that the ValidationSummary() uses unix newlines (\\n) and IE only likes the Windows newlines (\\r\\n). See if you can replace \\n with \\r\\n in before displaying it.

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