02.06.2013 Views

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

Pro PHP and jQuery by Jason Lengstorf.pdf - Computer Science ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

50<br />

CHAPTER 2 ■ COMMON JQUERY ACTIONS AND METHODS<br />

Figure 2-12. The yellow background shows the div successfully wrapped all paragraphs<br />

There’s one important note about .wrapAll(): it will move elements in the DOM to group them. To<br />

demonstrate this, use .wrapAll() to add a strong tag around all spans in the document:<br />

$("span").wrapAll("");<br />

After executing the comm<strong>and</strong>, note that the second span in the document was moved next to the<br />

first one so they could be wrapped in the same tag (see Figure 2-13).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!