Inserting content into an element

Interactive and dynamic web applications and websites not only require the web developer to be able to create DOM elements but also require the developer to be able to add dynamic content. This is easily achievable with another set of jQuery functions.

Getting ready

Create a blank HTML document named recipe-4.html, and ensure that you have the latest version of jQuery available to be included within this HTML document.

How to do it…

Learn how to dynamically add content into the DOM by performing each of the following steps:

  1. Add the following code to your newly created HTML document, which will create a simple HTML web page:
    <!DOCTYPE html> <html> <head> <title>Insert content into an element</title> <script src="jquery.min.js"></script> ...

Get jQuery 2.0 Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.