Learnerslesson
   JAVA   
  SPRING  
  SPRINGBOOT  
 HIBERNATE 
  HADOOP  
   HIVE   
   ALGORITHMS   
   PYTHON   
   GO   
   KOTLIN   
   C#   
   RUBY   
   C++   
   HTML   
   CSS   
   JAVA SCRIPT   
   JQUERY   




HTML METHODS - append()


The append() method in JQuery is used to insert a content at the end of an HTML element.


Example :



<html>
    <head>
    	<title> My First Programme </title>
  	</head>

  	<body>
    	<h1> JQuery </h1>
    	<p>New Code</p>
    	
    	<button> Click to set a new value </button>
    	

      	<script src = "https://cdnjs.cloudflare.com/ajax/libs/JQUERY/3.3.1/jquery.min.js"> </script>
	  
      	<script>
      
      		$('button').click( function() {
				$('p').append(" plus another code");
			});
			
            
      	</script>      
   </body>
</html>


Output :




So, in the above code, we have to to add a new content plus another code, and make it New Code plus another code.


<p>New Code</p>

And we have done it using the JQuery statement,


$('button').click( function() {
	$('p').append(" plus another code");
});

So, on button click, the append() function is called,


$('p').append(" plus another code");

And the content of <p> element,


New Code

Is added with,


plus another code

And the new content is printed on the screen,


New Code plus another code