Can anyone help me with this little conundrum, I’ve tried doing it in the shortest hand possible but I’m not sure if insertAfter works this way.
Can anyone suggest a working way of doing this.
I have made a fiddle of my problem.
I am simply trying to insert another custom li after the 5th li. But trying to do it in the most efficient way.
$('<li style="background: red"></li>').insertAfter( $('li').index(4) );
Can anyone help me with this please, thanks.
Josh
You may be confusing
.index()with.eq(). Use thisLive Demo