Append/Prepend Issue (attempt to match closing/opening tag positions)
I think I used to be able to do what I want to do now with an older version of jQuery but am now having problems. I want to insert a
SPAN into an
LI (yes, I uppercase my references to HTML elements when not within an XHTML document) so that I can have code like this:
- <li>Bullet Point example</li>
in the HTML but end up with this in the DOM:
- <li><span>Bullet Point example</span></li>
I have tried all different variations on the following code (sometimes trying appendTo/prependTo):
- $('LI').prepend('<span>');
- $('LI').append('</span>');
but the DOM seems to insist on ending up like this:
- <li><span></span>Bullet Point example</li>
Sometimes I even leave out the jQuery statement placing in the closing SPAN tag but find that it is still inserted in . . . and I could be wrong but I don't think jQuery did that to me before.