text formatting issue
text formatting issue
I have a bunch of pages on my movable type site that I want to use the pager plugin on. Now, these pages are formatted with two break tags after each line, and no tags wrapping around the lines. So my idea was to replace every other break tag with an opening div, and then every break tag immediately preceding those divs with a closing div tag... an inelegant solution that produces some ugly code but it seems to work. Almost.
It's outputting the divs formatted without a closing tag, which is compliant and exactly what I instructed, but not what I needed. So this code:
-
$("br:nth-child(even)").before('</div>').replaceWith("<div id='page'>");
replaces the even-numbered page breaks with
-
<div id="page"/>
and no end tags at all from the .before command. When I put some random text instead of the end-div, it prints that out, where I would want the end div's to have appeared. So I'm stumped as to how I can get jQuery to format this text properly, (aside from adding the extra html myself which I don't want to do).
