Joe,

>I would like to make the element list element clickable on the
>hovering of the list element.  I can't seem to traverse the DOM and
>grab the <a> tag's href value for the CURRENT list element that is
>being hovered over.
>
>$("#mainCol ul li").hover(function() {
>
>$(this).addClass("highlight").css("cursor","pointer").click(function()
>{
>       //location.href= will be used when this works!
>       var x = $(this).attr('href');

The "this" object is going to refer to your "li" tag. You can get what you
want be doing:

var x = $("a", this).attr('href');

- or -

var x = $(this).find("a").attr('href');

You also might want to use a selector of "> a" to make sure you only grab
anchor tags that are direct descendents of the "li" tag.

Also, I'd recommend using Firefox and the Firebug extension. Dumping items
to the console is a very good way to find out what object "this" is
referring to.

-Dan

Reply via email to