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