DOM tree manipulation
The .attr()
and .prop()
methods are very powerful tools, and with them we can make targeted changes to the document. We still haven't seen ways to change the overall structure of the document though. To actually manipulate the DOM tree, we'll need to learn a bit more about the function that lies at the very heart of the jQuery library.
The $() function revisited
From the start of this book, we've been using the $()
function to access elements in a document. As we've seen, this function acts as a factory, producing new jQuery objects that point to the elements described by CSS selectors.
This isn't all that the $()
function can do, however. It also boasts a feature so powerful that it can change not only the visual appearance ...
Get Learning jQuery - Fourth Edition 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.