Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 1. jQuery Basics > Getting and Setting HTML Content

1.16. Getting and Setting HTML Content

1.16.1. Problem

You need to get or set a chunk of HTML content in the current web page.

1.16.2. Solution

jQuery provides the html() method for getting and setting chunks (or DOM structures) of HTML elements. In the following code, we use this method to set and then get the HTML value of the <p> element found in the HTML document:


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial