Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6566863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:16:02+00:00 2026-05-25T14:16:02+00:00

this is my problem: I have captured a variable from a ul-li list I

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T14:16:02+00:00Added an answer on May 25, 2026 at 2:16 pm

    After looking at your other question, try this.

    $('#country_list').mousedown( function( e ) {
    
      // e.target is the element you clicked
    
      var $variab = e.target.innerHTML;
    
      var $alfa= '#' + $variab;  // Roma is now #Roma
    
      alert("You entered: " + $alfa); //control
    
      dialog($alfa);
    
    });
    

    Your #country_list element will listen for any mousedown events. When one occurs, you are able to find the element who generated the event with e.target.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this problem: I have a program which should fetch (let's say) 100 records
NOTE: I have solved the majority of this problem but have run into a
I am wondering how you would approach this problem I have two Taxrates that
I am trying to learn ASP.NET MVC and I hit this problem: I have
Ok I have this problem that I've never had before, it's really bugging me.
Ok I have this problem I'm trying to use Jquery to load a partial
So I have this problem with strings and switch-case, and I'll try to keep
I have this problem I'm hoping someone knows the answer to. I have an
I have this problem where I open Visual Studio and the internal windows are
i have this problem to find a particular xml node l have post this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.