0

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>?

Spudley
  • 166,037
  • 39
  • 233
  • 307
learning
  • 11,415
  • 35
  • 87
  • 154
  • 1
    What do you need this for? Can you elaborate on your situation? There may be a better/easier way for what you want to do. – Pekka Oct 06 '11 at 09:31
  • In the future, you really need to show the code that isn't working. – Tim Post Oct 06 '11 at 13:17

1 Answers1

2

This seems to be working fine everywhere:

"Hello<br />World".replace(/<br\s*\/?>/ig, "\r\n");
voldomazta
  • 1,300
  • 1
  • 10
  • 19