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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

48<br />

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

Figure 2-10. Use a callback function to conditionally wrap certain elements<br />

.unwrap()<br />

The inverse of .wrap(), .unwrap() will remove tags that surround a given element. It does not accept any<br />

arguments; it simply finds the immediate parent element <strong>and</strong> removes it.<br />

To unwrap the span elements in the example file, execute this code:<br />

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

This removes the parent elements (but leaves the text nodes intact), which alters the layout (see<br />

Figure 2-11).

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

Saved successfully!

Ooh no, something went wrong!