HTML Manipulation using jQuery

Using jQuery we can perform different methods of HTML manipulations.

For example if  you want to add the contents to the HTML elements you can use  jQuery append() or prepend()

Now let us see some of the jQuery manipulation functions

1. html() and text()

Both html() and text() returns or sets the contents of selected elements


2. Append() and Prepend()

Append() adds the content to the end of the selected element

Prepend() adds the content to the beginning of the selected element


<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
 $("p").prepend("<b>Hai!</b> ");
<p>Welcome to</p>
Posted in jQuery Tagged with: