Welcome to findnerd, today we are going to discuss on append() method in jQuery.
Firstly let know what use of append() method
Append() method is used for inserting at the end of the selected elements in jQuery
you can see bellow example how it work
<!DOCTYPE html>
<html>
<head>
<!-- here call the jquery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#btn").click(function(){
$("p").append(" How are you ?");// call append() to add text
});
});
</script>
</head>
<body>
<!-- here write paragraf in which you want add text-->
<p>Hi Joi</p>
<!--define button id -->
<button id="btn">Submit</button>
</body>
</html>
output will come following:
when you will click on submit button then "How are you ?" will be add in your end of paragraf.
Hi Joi How are you ?
0 Comment(s)