Clicking the button will add a red border to all of the LI elements with the class of "selected" that live in a UL.
To illustrate the use of query, we'll create a few HTML lists. When the button is clicked, we will add a red border to all
LIs that are descendants of
ULs, and have the class
Add some markup for the lists and a button to trigger the demo:
Now we will define the function that adds the border when the button is clicked, and assign it as a click handler.
This is a simple example of how to use the
Note: Logging and debugging is currently turned off for this example.
All YUI 2.x users should review the YUI 2.8.2 security bulletin, which discusses a vulnerability present in YUI 2.4.0-2.8.1.