[thelist] Navigating the DOM
Matt Warden
mwarden at gmail.com
Sun Apr 3 23:55:33 CDT 2005
On Apr 4, 2005 12:13 AM, Noah St.Amand <noah at tookish.net> wrote:
> <div id="shortcuts">
> <div class="block block-menu" id="block-menu-36">
> <h3>Shortcuts</h3>
> <div class="menu">
> <ul>
> <li class="expanded"><a href="residents" title="">Residents</a>
> <ul>
>
> Is there anyway to do this in the javascript:
>
> var menu = "the last ul in the example above"
> var actuator = "the a after <li class="expanded"> in the example above"
We can give you a specific solution, but it might just be easier for
you to use cssquery:
http://dean.edwards.name/my/
var menu = cssQuery('.expanded > ul', document.getElementById('shortcuts'));
or
var menu = cssQuery('div > ul > li > ul', document.getElementById('shortcuts'));
and then
var actuator = cssQuery('a', menu);
note that it returns an array of matches, even though you are
expecting only a single match in the array.
--
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com
This email proudly and graciously contributes to entropy.
More information about the thelist
mailing list