troubleshooting Question

Toggle multiple DIV on and off.

Avatar of openinterface
openinterface asked on
jQuery
7 Comments1 Solution2439 ViewsLast Modified:
Hi,

I have 5 divs which get displayed depending on what  heading is hovered over.  I want this popup to remain open until another selection is made, the previously opened DIV should be closed when a new selection is made.  Only one div should be open at a time.  The following code shows/hides them okay, but they dont stay open.
<script type="text/javascript">
  $(document).ready(function(){
  
  var $curr = $("#start");
    
  $(".msg_body").hide();
    
    $(".msg_head").hover(
      function () {
	  
	  $curr = $curr.prev();
	  
 
        $(this).next("$curr").show();
 
 
      }, 
      function () {
     $(this).next("$curr").hide();
      }
    );
	
  });
  
  </script>
 
<div id="goal1">
<div id="msg_list">
<p class="msg_head"><img src="images/goal1.gif" alt="Goal 1 Benchmarking" name="goal1" width="285" height="49"></p>
  
 
<div class="msg_body">
<strong>Goal 1</strong>Text text</div>
  </div>  
</div>
ASKER CERTIFIED SOLUTION
SRigney

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros