Skip to Main Content
Adobe® Dreamweaver® CS4 Bible
book

Adobe® Dreamweaver® CS4 Bible

by Joseph Lowery
March 2009
Beginner to intermediate content levelBeginner to intermediate
1321 pages
46h 24m
English
Wiley
Content preview from Adobe® Dreamweaver® CS4 Bible
710
Part III
Adding Advanced Design Features
Dreamweaver goes into Split view and then, once the document has loaded, displays the alert,
shown in Figure 18-3.
FIGURE 18-3
jQuery uses a ready() function to know when to begin processing.
Actual jQuery coding typically follows a specific pattern—one that Dreamweaver can easily follow.
The code usually starts off by identifying the object by ID, class name, tag, or other CSS selector,
like these examples:
$(“a”)
$(“#header”)
$(“.pullQuote”)
$(“ul a”)
82523c18.indd 710 2/18/09 1:31:13 PM
711
Working with JavaScript Frameworks
18
Once you’ve identified what’s to be affected, you provide an action or function. For example, if you
wanted to add a CSS class called
.highlight to all the <a> tags in your page, you would use code
like this:
$(“a”).addClass(“highlight”);
Note that the class name that is added does not include a leading period, so the attribute would be
written properly, that is,
class=”highlight” and not class=”.highlight”.
jQuery allows you to chain functions, one after the other. So, if you wanted to only add the
.high-
light
class to an <a> tag with a class of .current, you could write your code this way:
$(“a”).filter(“.current”).addClass(“highlight”);
Of course, jQuery can handle much more sophisticated effects. Let’s take a look at ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Adobe® Dreamweaver® CS5 Bible

Adobe® Dreamweaver® CS5 Bible

Joseph W. Lowery
Dreamweaver® CS3 Bible

Dreamweaver® CS3 Bible

Joseph W. Lowery

Publisher Resources

ISBN: 9780470382523Purchase book