html - Jquery Toggle visibility button -


im trying make button should make 1 element hiding (display: none;) , 1 visible , vice versa.

here example of sort of thing ive got:

example

at moment when clicking 'technical details' changes display: none; display: block; on element. need make element under hidden when 1 shown...

here code im using...

function toggle() { var ele = document.getelementbyid("toggletext"); var text = document.getelementbyid("displaytext"); if(ele.style.display == "block") {         ele.style.display = "none";     text.innerhtml = "technical details"; } else {     ele.style.display = "block";     text.innerhtml = "product information"; } }  

hope makes sense , in advance...

why don't wrap 2 different text html elements in span , give them , links class called "toggleprdctandtech". set default hidden ones display:none; can toggle them in function this

function toggleelements(){   $(".toggleprdctandtech").toggle(); } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -