append( ) property is used to insert a block of elements inside a particular element. It helps in adding block of element during runtime.This property insert's content, specified by the parameter, to the end of each element in the set of matched elements.
<!DOCTYPE html>
<html>
<head>
<title>append() property</title>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<p><button type="button">add more settings</button></p>
</body>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
alert('asdf');
$("body p").append('<div><label>enter phone no.</label><input type="text"></div>');/*it adds block of element inside <p> tag*/
});
});
</script>
</html>
0 Comment(s)