I have the following HTML
<ul>
<li>Some stuff first<li>
</ul>
Basically I am using appendTo(ul) to append a bunch of stuff to this but I want it to actually append AFTER the first child li ?
How can I do this ?
I’ve tried .appendTo(ul).insertAfter('li:first');
You don’t need to combine
appendToandinsertAfter, you can just useinsertAfterand make the selector more specific:Here’s a working example.
Edit based on comments
I think what you mean is that you already have the
ulin a variable and would like to use that. If that’s the case, you could try something like this:Here’s an example of that one.