Newline processing

Recently with easy ui text box to change the line to save the data, use the controls to get away, and I want to achieve wrap, observed that easy ui default line feed data will add a line break --- (↵).

Solutions are as follows:

 
function returnbr(val) {
   return val.replace(/(\r\n|\n|\r)/gm, "<br />");
} 

Mainly on replacing just fine


val.replace (/ (\ r \ n | \ n | \ r) / gm, "<br />")


my example:
List [I] .Value =. 1: Test wrap ↵2: Test wrap ↵3: test wrap ↵4: test wrap ↵5: test wrap

 

js inside:

list[i].Value.replace(/(\r\n|\n|\r)/gm, "<br />")

 

Guess you like

Origin www.cnblogs.com/condon/p/11410601.html