The number of divs is variable, but they all share a parent container:
<div>
<span><br/></span>
Lorem Ipsum
</div>
<div>
<!-- need a span here -->
Lorem Ipsum
</div>
<div>
<span><br/></span>
Lorem Ipsum
</div>
<div>
<!-- need a span here -->
Lorem Ipsum
</div>
<div>
<span><br/></span>
Lorem Ipsum
</div>
How do I prepend a span tag to all the divs which don’t have one. All the spans will be the same, they just have a line break so later on I can call text() on the parent and those will be converted into \n‘s so the grouped content will show up nicely in an email where enctype="text/plain".
Working demo – http://jsfiddle.net/ShankarSangoli/snJhY/