From the course: jQuery Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Altering page content - jQuery Tutorial
From the course: jQuery Essential Training
Altering page content
- [Narrator] We've talked about creating content. We've talked about inserting content. Now let's talk a little bit about altering content that is already in the page. In your editor, let's open the altering_start file, and the first function I'm going to demonstrate is the wrap function. So let me put the code in, and I'll write a selector that gets all the paragraph tags, and we're going to call wrap, div style equals color red. So I have to close that div off. Let's save that. The wrap function wraps content around existing content. The argument that you give to the wrap function is the content that you want to wrap around the result of this jQuery expression. If you look at the document, you can see that this is pretty much the sample we've been using throughout the course, so far, so here's our example div. Here's all these paragraphs that we've been working with. So this line of code, is going to select each paragraph and then wrap each paragraph inside a div whose style…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.