Horje
javascript replace newline with br Code Example
javascript replace newline with br
function nl2br(str){
 return str.replace(/(?:\r\n|\r|\n)/g, '<br>');
}
var stringWithNewLines= `Well this is a
a very broken
sentance`;
var stringWithBrs=nl2br(stringWithNewLines);
// stringWithBrs= "Well this is a<br>a very <br>broken<br>sentance"
javascript replace
with n
var str = $("#mydiv").html();
var regex = /<br\s*[\/]?>/gi;
$("#mydiv").html(str.replace(regex, "\n"));




Javascript

Related
angular 11 on hover Code Example angular 11 on hover Code Example
DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect. Code DeprecationWarning: current URL string parser is deprecated, and will be removed in a future version. To use the new parser, pass option { useNewUrlParser: true } to MongoClient.connect. Code
length of dict js Code Example length of dict js Code Example
jquery on enter key pressed Code Example jquery on enter key pressed Code Example
react-native italics Code Example react-native italics Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10