variables and jquery: how capture value and use them (part 2)

this is my problem:

I have captured a variable from a ul-li list

I have a list with a lot of names: Roma, Milano, Venezia …
I capture the id value of these (pulsante1 for Roma, pulsante2 for Milano, pulsante3 for Venezia, … ) with a mouseover event (look for this question variables and jquery: how capture value (part 1) if you want to know more).

So, I have now a global variable called $ regionMap, and the its content changes every time the ul-li list has a mouseover event.
So, now I could use $ regionMap value instead of the different id values (pulsante1, pulsante2, pulsante3…) in other jquery scripts.

For example I have this loop:

$  ('#pulsante1').mousedown(function() // when click over pulsante1 (id value for "Roma")
        {
var $  variab=document.getElementById('pulsante1').innerHTML; // take the name (here Roma)
var $  alfa="#"+ $  variab;  // Roma is now #Roma
alert("You entered: " + $  alfa); //control
dialog($  alfa); // calling the function dialog rolling on #Roma value.
});

// here is similar at the first but instead #pulsante1(Roma) you have #pulsante2 (Milano)
$  ('#pulsante2').mousedown(function()
        {
        var $  variab=document.getElementById('pulsante2').innerHTML;
        var $  alfa="#"+ $  variab;
        alert("You entered: " + $  alfa); //control
        dialog($  alfa); // calling the function dialog
        });
                    });//close click

Now, I would like use $ regionMap instead pulsante1, pulsante2… but for me is impossible!
I try so $ ($ regionMap).mousedown(function() and in other way ( $ ($ regionMap)., ($ regionMap)., $ ('$ regionMap'). …. ),

but I have always no results! How can I do? You know how pass a variable?

I think that probably there is a better way to obtain similar result (for example with a loop *for in *) but I don’t know how to it…

Sorry for my long post and sorry for the basical english, but I’m not a developer and I have gone in a big TILT!

thanks

newest questions tagged jquery – Stack Overflow

About Admin