Using after method in jquery

To add an html element or some text right after an html element we use after method of jquery. This will add the given element/text right after the element which we are targeting.

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

 <script type="text/javascript">

    function AddAfterDiv() {
        $("#myDiv").after("<This is appended after div");
    };
   </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