jQuery and the document object model

The DOM defines a standard for accessing HTML and XML documents:

"The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document."

The following are some ways of DOM manipulation in jQuery:

  • text(): This sets or returns the text content of the selected elements
  • html(): This sets or returns the content of the selected elements
  • val(): This sets or returns the values of form fields

Get Web Developer's Reference Guide 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.