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

  • SEARCH
  • Home
  • 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 6985319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T18:39:53+00:00 2026-05-27T18:39:53+00:00

i would like too set a link for every state ,and every city. when

  • 0

i would like too set a link for every state ,and every city.
when the state li is hovered over i only want that this states cities to show ….
but i kno only a little jquery code and im not perfect with understanding the selectors,
im not to sure on how to use the .each jquery function…. please help!!!!
php code:

<?
$everything = array(
        'states'=>array(
            'Alabama'=>array('Birmingham,Montgomery,Mobile,Huntsville,Tuscaloosa'),
            'Alaska'=>array('Anchorage,Juneau,Fairbanks,Sitka,Ketchikan'),
            'Arizona'=>array('Phoenix,Tuscon,Mesa,Glendale,Scottsdale'),
            'Arkansas'=>array('Little Rock,Fort Smith,North Little Rock,Fayetteville,Jonesboro'),

        )
);
$id = md5(0);
$controll = 0;
$here = md5('states');
echo "<div id=\"9090\"><ol id=\"selectable\">";
    foreach($everything['states'] as $state=>$city){
    $citys = explode(',',$city[0]);
    echo    "<li class=\"ui-state-default\"><a class=\"contr\" href=\"#\">$state</a> <div class=\"citys\">";
        foreach($citys as $key=>$x){
            echo "<a href=\"#\">$x</a><br>";    
        }
    "</div></li>";
    }

echo "</ol></div>";
?>

jquery :

    <script>

        $(function() {
            $( "#selectable" ).selectable();
        });
        $('.ui-state-default').mouseenter(function(e) {
// here when i hover over this state all citys show i just want the cities for this sate
            $('.citys').toggle();
        }).mouseleave(function(e) {
// here when i leave  this state li all theese citites should leave
            $('.citys').toggle();
        });;

    </script>
  • 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-27T18:39:54+00:00Added an answer on May 27, 2026 at 6:39 pm

    You need to add context when finding the cities, like this $('.citys', this).toggle();
    This will search for .citys elements located inside this which in this case is the hovered .ui-state-default element.

            $('.ui-state-default').mouseenter(function(e) {
                $('.citys', this).toggle(); // added this 
            }).mouseleave(function(e) {
                $('.citys', this).toggle(); // added this 
            });
    

    See how to use the context parameter at http://api.jquery.com/jquery/#jQuery1


    Alternatively you can use .find()

    $(this).find('.citys').toggle();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to set up a persistent state for my application. Let me
I have a multi-line TextView that has android:ellipsize=end set. I would like to know,
I would like to customize the background (and maybe the border too) of all
I would also like to reset the font-size of <small> tag too normal HTML
It doesn't seem like it would be too hard to implement in assembly. gcc
Would like to be able to set colors of headings and such, different font
Would like to make anapplication in Java that will not automatically parse parameters used
So what I would like to do is scrape this site: http://boxerbiography.blogspot.com/ and create
I have recently set up a bugzilla instance for bug tracking and would like
I have one issue with floating divs. I would like to set all divs

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.