Reputation: 229
I want to make a linkebreak in a String. In HTML it's like this (if I replace the T with a linkebreak):
mystring.replace("T", "<br>");
But this doesn't work in JavaScript. The <br>
is part of the String too. How do I implement this in JavaScript? Thanks!
mystring BEFORE linkebreak:
2013-10-22T22:56:25.534Z
mystring AFTER linebreak:
2013-10-22T
22:56:25.534Z
Upvotes: 1
Views: 135
Reputation: 7666
If you want the T in your statement you can do something like
mystring = mystring.replace(/T/, "T\n");
Upvotes: 0
Reputation: 2831
You can achieve it by doing like :
var mystring = "2013-10-22T22:56:25.534Z";
console.log(mystring.replace("T", "\n"));
Upvotes: 2
Reputation: 2573
is used for html, in javascript normal new line character '\n' will do the trick, so you need to replace T with this new line character '\n' rather than
mystring.replace("T", "\n");
Upvotes: 0