W3Schools.com

jQuery HTML Manipulation


jQuery contains powerful methods (functions) for changing and manipulating HTML elements and attributes.


Changing HTML Content

$(selector).html(content)

The html() method changes the contents (innerHTML) of matching HTML elements.

Example

$("p").html("W3Schools");

Try it yourself »


Adding HTML content

$(selector).append(content)

The append() method appends content to the inside of matching HTML elements.

$(selector).prepend(content)

The prepend() method "prepends" content to the inside of  matching HTML elements.

Example

$("p").append(" W3Schools");

Try it yourself »

$(selector).after(content)

The after() method inserts HTML content after all matching elements.

$(selector).before(content)

The before() method inserts HTML content before all matching elements.

Example

$("p").after(" W3Schools.");

Try it yourself »


jQuery HTML Manipulation Methods From This Page:

Function Description
$(selector).html(content) Changes the (inner) HTML of selected elements
$(selector).append(content) Appends content to the (inner) HTML of selected elements
$(selector).after(content) Adds HTML after selected elements

For a full jQuery HTML reference, please go to our jQuery HTML Methods Reference.



WEB HOSTING
Best Web Hosting
PHP MySQL Hosting
Best Hosting Coupons
UK Reseller Hosting
Cloud Hosting
Top Web Hosting
$3.98 Unlimited Hosting
Premium Website Design
WEB BUILDING
XML Editor - Free Trial!
FREE Website BUILDER
Best Website Templates Top CSS Templates
CREATE HTML Websites
EASY WEBSITE BUILDER
W3SCHOOLS EXAMS
Get Certified in:
HTML, CSS, JavaScript, XML, PHP, and ASP
W3SCHOOLS BOOKS
New Books:
HTML, CSS
JavaScript, and Ajax
STATISTICS
Browser Statistics
Browser OS
Browser Display
SHARE THIS PAGE