I have a list that I cannot interrupt with javascript to add a title:
From:
<ul> <li>1</li> <li class="afterthis">2</li> <li>3</li> <li>4</li> </ul>
To:
<ul> <li>1</li> <li class="afterthis">2</li> </ul> <h1>Title</h1> <ul> <li>3</li> <li>4</li> </ul>
I thought it was easy to do: $(".afterthis").after("</ul><h1>Title</h1><ul>");
but it doesnβt close the list, it moves the end tag, it inserts <h1>Title</h1><ul></ul>
to see the problem see this jsfiddle http://jsfiddle.net/Fx74b/14/
source share