Home > DeveloperSection > Forums > How to use append() method in jquery.
Ankit Singh

Total Post:341

Posted on    January-19-2016 10:14 PM

 JQuery JQuery  JavaScript 

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

aditya kumar Patel

Total Post:250

Posted on    January-19-2016 10:21 PM

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="http://www.w3.org/1999/xhtml">
    <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);

Don't want to miss updates? Please click the below button!

Follow MindStick