HTML and CSS Reference
In-Depth Information
$(this).css(“color”, “#999”);
$(“#emailFormSubmit”).attr(“disabled”, “disabled”);
else {
If the user leaves the field having set a value, the disabled attribute is removed from the
Submit button, as shown in Figure 16.11. If the user leaves the field without having
entered anything, the disabled attribute is added, just in case it was previously removed.
FIGURE 16.11
The Submit button
is no longer dis-
abled after an
email address is
Adding and Removing Content
jQuery provides a number of methods that can be used to manipulate the content on the
page directly. Here's a more complex example that demonstrates several ways of manip-
ulating the content on a page—users can add new content to the page, remove content
from the page, and even wipe out all the content inside an element in one click. The ini-
tial page appears in Figure 16.12.
FIGURE 16.12
A page that allows
you to add and
remove content
Search WWH ::

Custom Search