I want to change all the open characters in the string to br tag.
For example,
"This is man.
Man like dog.
Man like to drink.
Man is the king."
I don't know how to use these strings
"This is man<br /><br />Man like dog.<br />Man like to drink.<br /><br />Man is the king."
I want to change it like this. Please tell me what to do.
I'll write a regular expression
str = str.replace(/(?:\r\n|\r|\n)/g, '<br />');
You can do it in this way.
© 2024 OneMinuteCode. All rights reserved.