[jQuery] Re: Replacing brs in a div

2009-12-09 Thread T.J.
Reading through the documentation, it seems that either would work, if you provide a selector... Try something like.. var $html = $(#DivID).html(); $(br, $html).replaceWith(\r\n); could maybe work? I'm no expert on this at all, that's just my initial thought. On Dec 9, 9:49 am, Mad-Halfling

[jQuery] Re: Replacing brs in a div

2009-12-09 Thread MorningZ
but I can't quite get my head around how to use those methods The docs: http://docs.jquery.com/Manipulation/replaceWith http://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

[jQuery] Re: Replacing brs in a div

2009-12-09 Thread MorningZ
oops.. my .replace() above is wrong... could maybe work? yeah, but why not just use basic JS for the task instead? whatever i suppose...

[jQuery] Re: Replacing brs in a div

2009-12-09 Thread T.J.
I guess that just depends on whether or not the .html() is treated as a string or as an object with HTML elements. If it's a straight up string, .replace like you said would work just fine. If it's a collection of HTML elements, the jQuery method should work. Again, I'm just fumbling around here,

[jQuery] Re: Replacing brs in a div

2009-12-09 Thread Mad-Halfling
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

Re: [jQuery] Re: Replacing brs in a div

2009-12-09 Thread T.J. Simmons
Yeah, I wasn't really sure it would work, but thought it was worth a try. And the br/ br thing I think depends on the browser used and the rendering mode it's forced into. What doctype are you using? And for some more thought, Firefox (using !doctype html) renders br as br, but IE8 will show

[jQuery] Re: Replacing brs in a div

2009-12-09 Thread RobG
On Dec 10, 3:24 am, T.J. Simmons theimmortal...@gmail.com wrote: Yeah, I wasn't really sure it would work, but thought it was worth a try. And the br/ br thing I think depends on the browser used and the rendering mode it's forced into. What doctype are you using? And for some more