I must allow the user to enter carriage returns in text areas; sort of:
Offer 1Offer 2...
I have to keep these carriage returns when loading and saving data. I am using jQuery on the client side and .NET on the server. Any suggestions on how to approach?
Thanks.
If "persist" breaks a line ( CRLF ), you mean that you want to display it correctly, as SO does, you need to remember to replace the CRLF pair with <br/>CRLF .
CRLF
<br/>CRLF
Otherwise, all text will appear sequentially.
You do not need to do anything special. What <textarea> does, and if you donβt take much effort to highlight the newlines on the server side, you can load them with the standard string without any problems.
<textarea>
string
Use jQuery.val () hook :
$.valHooks.textarea = { get: function( elem ) { return elem.value.replace( /\r?\n/g, "\r\n" ); } };
Source: https://habr.com/ru/post/1311935/More articles:Visual Studio 2010 with Extensiblity Managed Platform - visual-studio-2010div contenteditable = "true" - jquerySolr - getting facets for the unfiltered version of a query - solrFASM vc MASM translation problem in mov si, msg offset - assemblyhttps://translate.googleusercontent.com/translate_c?depth=1&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1311934/need-to-format-a-set-of-float-variables-to-0000&usg=ALkJrhgnRHH5wmnPOjWs57vLa_ptI6SIAwstructure initialization - cError creating with xcodebuild - xcodeHow to search for PDF? - c ++How to apply style to an existing tikz node on specific slides - latexRSA data decryption in C # (.NET 3.5), which was encrypted using openssl in php 5.3.2 - c #All Articles