How one can add li to middle of the ul.
For example if i have list like this:
- 1
- 2
- 3<
var middle = Math.ceil($("#myUL li").length / 2);
$("#myUL li:nth-child(" + middle + ")").after('<li>Item New</li>');
Try this:
$('ul li:eq(2)').after(`<li>new</li>`)
Use ' or " within braces I have used ` since it was getting formatted as html.
Try this out:
$('ul li:nth-child(3)').after('<li>new</li>');