How To Add li In An Existing ul Using jQuery
Here we consider how to add a list item in an existing ul using jQuery.
Lets start with one example here.
Suppose we have an unordered list as shown below.
We would like to add following li to this ul.
For adding more li to ul, we can make use of jQuery append.
First of all, find the ul by using its ID.
And then use jQuery append as shown here.
$(".parent").append(' <li> <a href=" http://twitter.com " > Twitter </a> </li> ');
That's all, by using jQuery append, we can add li in an existing ul.