How to use append() method in jquery.

Total Post:341

 872  View(s)
Rate this:
I want to use append() method in jquery. how to do this please help me.
  1. Post:282

    Re: How to use append() method in jquery.

    when we want to add dynamically data to existing elements  in html using jquery. we can use append() method in jqery.

    <!DOCTYPE html>
    <html xmlns="">
        <script src="Scripts/jquery-2.1.4.js"></script>
    <a href="javascript:void(0);" onclick="AppendList();">Append List</a>  
    <ul id="ullist"></ul>

    <script type="text/javascript">
        function AppendList() {
            var item1 = $("<li></li>").text("Item 1");
            var item2 = "<li>Item 2</li>";
            var item3 = document.createElement("li");
            item3.innerHTML = "Item 3";
            $("#ullist").append(item1, item2, item3);