javascript - toggle class content on click from nav -
I have a simple page with 15 elements in the NAV bar (only 4 in the JSFDial example to keep the code).
I have a JavaScript that transfers the border-down display when clicking on NAV bar elements, but I would like to change the content of that box on the basis of which click the name object is.
This is it.
Ive tried getElementByID, but somehow I cant seem to change the class under my # tab-content div ... I have a javascript loop that changes the content of each section element
This
          "tab-on" ; & Lt; a href = "# section1" onclick = "display (section 1) class =" icon icon-dash "& gt; & lt; span & gt; dashboard & lt; / span & gt; & lt; / a & gt; & Lt; / li>    and I want to show it to show for id = section2 and to show the hide class for section 2: < / P> 
   
  1 & Lt; / p & gt; & lt; / section & gt; section & lt; section id = "section2" class = "hide"> 
 
 2  & lt ; / Section>   
 Any thoughts please?  
 Cheers, M.    
 
  Is it looking for you Since you have  href  in each  section  of  id , you can drag it to properly load:   JS    var currentTab = $ (this). Symbol ("a"). Attr ("href"); $ (CurrentTab) .show () Brother Sister ("Sections ") Hide () ..    Change the CSS (unless you want the elements to take place on the page to determine for your performance better):  
  # tabs-content section.show {display: block} # tabs-content section.hide {display: none; }      
 
  
 
    
Comments
Post a Comment