Web Development with jQuery®

(Elliott) #1

Manipulating HTML and Text Content (^) ❘ 107



Groucho Marx Quotes







Before I speak, I have something important to say. - Groucho Marx






The following CSS is linked to the preceding HTML document:
body {
font: 12px "Lucida Grande", Arial, sans-serif;
color: rgb(50, 50, 50);
margin: 0 ;
padding: 15px;
}
The following script applies HTML content to all the

elements in the document:
$(document).ready(
function()
{
$('p').html(
'Quote me as saying I was mis-quoted. ' +
'- Groucho Marx'
);
}
);
Figure 4-10 shows a screen shot of the output. You see that the quote applied in the script has been
applied to all three

elements, replacing whatever content was present previously, if any.

FIGURE 4-10


http://www.it-ebooks.info

Free download pdf