Web Development with jQuery®

(Elliott) #1

(^122) ❘ CHAPTER 4 MANIPULATING CONTENT AND ATTRIBUTES



Mitch Hedberg Quotes




Dogs are forever in the push up position.





I haven’t slept for ten days, because that would be too long.





I once saw a forklift lift a crate of forks. And it was way
too literal for me.





The HTML document is joined with the following style sheet:
body {
font: 12px "Lucida Grande", Arial, sans-serif;
color: rgb(50, 50, 50);
margin: 0 ;
padding: 15px;
}
div {
padding: 5px;
border: 1px dashed black;
background: orange;
margin: 5px 0 ;
}
p {
margin: 5px;
}
Then, the following JavaScript unwraps each

element from its parent

element.
$(document).ready(
function()
{
$('p').unwrap();
}
);
The JavaScript removes each
element from the document, which results in the HTML struc-
ture shown in Figure 4-17.
[http://www.it-ebooks.info](http://www.it-ebooks.info)