Using variable name in click, cant see why not working :-(

Using variable name in click, cant see why not working :-(

Hi

I'm developing a distributor map thing on our company web site, and when a continent is clicked, it sets a variable called 'activeContinent'.

However this works:
  1. // Outputs 'Africa' in message box
  2. $('.continent_africa').click(function() {
  3. alert(activeContinent);
  4. var currentId = $(this).attr('id');
  5. });

This doesn't, and I can't see why:
  1. // Outputs sod all...
  2. $('.continent_'+activeContinent).click(function() {
  3. alert(activeContinent);
  4. var currentId = $(this).attr('id');
  5. });
I Really cannot see why it won't work. activeContinent is a global variable, and it does have a value, so why won't this work?!

Thanks in advance!
Ste