Thanks for the suggestions folks, I tried var $html = $("#DivID").html(); $("br", $html).replaceWith("\r\n"); but it doesn't seem to work, but it's something like that I thought I might be able to get funky and do - I had a look at the JQ homepage docs, but as you can see they are a little sparse in the different ways of using the methods beyond the basics - can anyone else think of a way, or is that (as I suspect) not what they are intended for?
WRT replace and >> jQuery is not the answer for everything, sometimes simple JavaScript >>(which deep down jQuery is using anyways) is the solution I think a regex is the way to go, if there isn't any neat way of doing it with replaceAll/With as I mentioned above, as the brs seem to be slightly odd - I put them in as <br /> but if I alert() the div's html () they come out as <BR> On Dec 9, 4:11 pm, MorningZ <morni...@gmail.com> wrote: > "but I can't quite get my head around how to use those methods" > > The docs: > > http://docs.jquery.com/Manipulation/replaceWithhttp://docs.jquery.com/Manipulation/replaceAll > > would be the place to understand those methods, which just reading the > first few lines of each > > "Replaces the elements matched by the specified selector with the > matched elements" > "Replaces all matched elements with the specified HTML or DOM > elements" > > makes it pretty clear they are not for simple text replace... > > $('#TextAreaID').val($('#DivID').html().replace("<br />", "")); > > jQuery is not the answer for everything, sometimes simple JavaScript > (which deep down jQuery is using anyways) is the solution