Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

JavaScript .click() not changing CSS "display" property

I’m trying to make a navigation bar which on click to make visible a div that has been previously hidden with display: none. Below is what I have till now:

Navigation bar:

$(document).ready(function() {
      $('#home').click(function() {
        $('.site-content').html($('#home_wrap'));
      });

      $('#skills').click(function() {
        $('.site-content').html($('#skills_wrap'));
      });
#home_wrap,
#skills_wrap {
  display: none;
}

.site-content {
  max-width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
<div class="nav__content">
  <ul class="nav__list">
    <li class="nav__list-item" id="home" href="#">Home</li>
    <li class="nav__list-item" id="skills" href="#">Skills</li>
  </ul>
</div>

As this is an old project, I think the navigation used to work but now it’s not.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try to use: $(‘#home_wrap’).show()

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading