Append html/text in an html element

To append some text or an html element within an html element we use append method. This will append the given text/html to end of the element in which we are appending.

<input type="button" value="Append To Div" onclick="Append()" />
<div id="myDiv" class="myClass">
    This is a div
</div>            


<script type="text/javascript">
    function Append() {
        $("#myDiv").append("<h1>This text is appended by jquery</h1>");
    }
   

</script>

Comments

Popular posts from this blog

Check if ViewBag is null or doesn't exist

Using Progress Bar In C#

Jquery serer side datatables in asp.net