JavaScript Re-hide dynamic div content when a new selection is made jquery show hide dynamic content

I need your help,

While the code below works great to dynamically switch my div content, the problem now is that the javascript code does not hide the user's previous selection. Any ideas on how to amend the code to dynamically switch div content and hide the users previous selection that was made?

Here is the HTML and Javascript:

<!DOCTYPE html>    
<html>    
<head>    
<script src="jquery-1.11.3.min.js"></script>
<script type="text/javascript">    
window.onload = function() {    
    $("li").click(function(){            
          var $li = $(this);              
          var selector = $li.data("show");   // => "#item1"                       
          $(selector).removeClass("hidden"); //but show matching item              
    });    
}
</script>    

<style type="text/css">    
#container {
    bottom: 0; left: 0; top: 0; right: 0;
    margin: auto;
    position: absolute;
    width: 900px;
    height: 600px;
}
#list {
    list-style-type: none;
    padding: 0;
    margin: 0;
}
#list li {
    margin:0 0 10px 0;
    background: grey;
    padding: 3px;
    cursor: pointer;
}
.item {
    width: 100%;
    height: 100%;
    background: rgb(192,192,192);    
}
#menu {
    float: left;
    width: 25%;
    background-color: #ff99CC;
    height: 100%;
}
#content {
    float: left;
    width: 75%;
    background-color: rgb(192,192,192);
    height: 100%;
}
.hidden{ display:none; }
</style>

</head>    
<body>    
    <div id="container">        
        <div id="menu">         
            <ul id="list">
               <li data-show="#item1">Coffee</li>
               <li data-show="#item2">Tea</li>
               <li data-show="#item3">Ice Cream</li>
            </ul>           
        </div>          
        <div id="content">          
        <div id="item1" class="hidden item">Something about coffee...</div>         
        <div id="item2" class="hidden item">Things about tea...</div>           
        <div id="item3" class="hidden item">Things about ice cream...</div>
        </div>        
    </div>
</body>    
</html>
Answer:1

I have solved the seventh problem of Euler, it says: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? ...

I have solved the seventh problem of Euler, it says: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? ...

I'm trying to use d3-arrays in a project. The module itself includes both original ES6 modules and a UMD build. I would expect to be able to add this directly as a dependency to my ember-cli project ...

I'm trying to use d3-arrays in a project. The module itself includes both original ES6 modules and a UMD build. I would expect to be able to add this directly as a dependency to my ember-cli project ...

  1. cannot import module python
  2. cannot import module in jupyter
  3. cannot import module python3
  4. cannot import module in same directory
  5. cannot import module '@nuxt/webpack'
  6. cannot import module '@nuxt/core'
  7. cannot import module in pycharm
  8. cannot import module js
  9. cannot import module in same directory python
  10. cannot import module activedirectory
  11. cannot import module
  12. cannot import module powershell
  13. cannot import module msonline
  14. cannot import module 'ts-node' nuxt
  15. cannot import module android studio
  16. cannot import module flask
  17. cannot import module django
  18. cannot import ad sync module
  19. cannot import module vmware.vimautomation.core
  20. cannot import module with spaces in tag ''

Here is my code <div class="EquipmentContent row"> <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 subSection" style="float:right;background:#dff0ff;"> <section ...

Here is my code <div class="EquipmentContent row"> <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6 subSection" style="float:right;background:#dff0ff;"> <section ...

  1. dynamically append button

I am trying to convert an array to a new set of arrays by value, in this case, id. Input let array = [ {"item": {"id": 111, "name": "item1"}, "qty": 1}, {"item": {"id": 222, "name": "item2"}, "...

I am trying to convert an array to a new set of arrays by value, in this case, id. Input let array = [ {"item": {"id": 111, "name": "item1"}, "qty": 1}, {"item": {"id": 222, "name": "item2"}, "...

  1. group nested array mongodb
  2. group nested array
  3. group multidimensional-array php
  4. mongodb group nested array
  5. mongodb aggregate group nested array
  6. nested array mongodb