Regexp seems indeed the simplest way to acheive it. Something like this
might just work :
whatever_string.replace(/<(\/?)\s*br>/gi, "\r\n")

Michel Belleville


2009/12/9 Mad-Halfling <mad-halfl...@yahoo.com>

> Hi, this seems like a stupid question, but I'm not quite sure if I can
> do it or not.  I am copying the contents of a div into a textarea like
> this:-
> $('#TextAreaID').append($('#DivID').html());
> and it works ok, but I need to replace any <br /> tags in the divs
> content with \r\n - can I do this with replaceAll or replaceWith or do
> I need to use regexs?
>
> Sorry for such a silly question, but I can't quite get my head around
> how to use those methods and if I can use them on plain text as they
> seem to either run on the whole doc or (if used in an element's
> function) "this".
>

Reply via email to