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
Post a Comment