Hi. I'm very new to jquery, and a lightweight coder, so apologies for
the newbie question.
I think I understand the implied loop declarative nature of jquery
selectors, that say (sort-of) for everything matching the selector
do{ some stuff }
What i'm struggling to get my head around is how this works inside a
function once you HAVE a this object?
Example:
I have a list of the form-
ul id=map
lia class='EM' href='#' title='East Midlands'spanEast
Midlands/span/a/li
lia class='NE' href=# title='North East'spanNorth East/
span/a/li
/ul
This inside my document.ready I have a function like this-
$('#map li').hover(
function(){
region= $('this a:first').attr('class'); // Tries to
find the
class of the first a in li
//
but always returns undefined??
do_something_with_the_region();
},
function(){
undo_something_with_the_region();
}
);
The piece that says region= $('this a:first').attr('class'); is my
(clearly incorrect) attempt at the incantation to say Give the
current object (an il), return the class attribute of the first
anchor that is a child of the current item.
I suspect I haven't got the right idea at all, can anyone point me in
the right direction?
Regards: colin_e