change <br /> to \n\r in firefox and chrome [closed]
I have done text replacement in Javascript such that the <br />
tag will be replaced by the \n\r
. This seems to work in IE8.开发者_开发知识库0 but not in chrome and firefox. why is that so? How can I make it work in chrome and firefox. Why does chrome and firefox not consider <br/>
tags as <br/>
but rather <br>
?
This seems to be working fine everywhere:
"Hello<br />World".replace(/<br\s*\/?>/ig, "\r\n");
精彩评论