This method is used to insert the data at the end of the selected elements . It is just opposite of the prepend( ) method . Prepend ( ) method is used to insert the data at the beginning of selected elements . Syntax :
$(selector).append(content,function(index,html))
Example : HTML Code :
<html>
<head></head>
<body>
<button id="button1">After click ,Data added at the end of p tag</button>
<p>Hello Mukesh Tomar</p>
<p>From Meerut</p>
</body>
</html>
jQuery Code :
$(funtion(){
$("#button1").click(function(){
$("p").append("<b>I have added at the end of p tag</b>");
});
});
Output :
I have added at the beginning of p tag.Hello Mukesh Tomar
I have added at the beginning of p tag .From Meerut
0 Comment(s)