and
tags?This is what the HTML code looks like. I need to strip out the br tags and wrap the lines in paragraph tags (ie the lines with dates). Each date should be wrapped in its o
Edit: By using <p>
tags in that manner your runining it's whole purpose instead you should try removing the <br>
tags and placing the text inside <p>
elements, which will have the same effect but will be semantically correct.
Edit2: I think you wanted it in the above way, just triple read your question and I think I gotcha!
var $p = $('.details p');
$p.contents()
.filter(function() { return this.nodeType == 3; }) // Select all textnodes
.wrap('<p>') // Place them inside paragraph elements
$('br', $p).remove(); // Remove all break elements
Working fiddle: http://jsfiddle.net/garreh/UWDw5/1/