replace the replacement will only replace the first character finds

e.target.value.replace (/ \ n / g, ' < br /> ') // with / g can solve the regular expression \ n replace <br/>

If a string, then you can directly replace

 

Guess you like

Origin www.cnblogs.com/lvlvlv/p/11607642.html