Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Programming (https://www.warriorforum.com/programming/)
-   -   Need Javascript showing two hidden css divs (https://www.warriorforum.com/programming/726826-need-javascript-showing-two-hidden-css-divs.html)

Christopherson 16th December 2012 12:23 AM

Need Javascript showing two hidden css divs
 
<body>
<center>
<div id="header"></div>
<div id="wrapper">
<div id="content">
<div id="contenth">
<h1 id=>content header</h1>
</div>
content
<a href="#" onclick="changeDiv(1)">Menu 1</a> ///change to other div
<a href="#" onclick="changeDiv(2)">Menu 2</a>
<script>
function changeDiv(i){
if(i==1)
document.getElementById("content").innerHTML = document.getElementById("step2").innerHTML;
else
document.getElementById("step2").innerHTML = document.getElementById("content").innerHTML;
}
</script>
</div>
</div>
<div id="step2"> // Showed on click
<div id="step2h">//want to show this as well
<h1>STEP 2 Header</h1>
</div>
<h2>Step 2 Content</h2>

</div>
</center>
</body>


This is my current script but I want to show not only step but step2h as well in one click.

FirstSocialApps 16th December 2012 12:42 AM

Re: Need Javascript showing two hidden css divs
 
Using JQUERY:

$('#content').append($('#step2h').html());

Christopherson 16th December 2012 12:52 AM

Re: Need Javascript showing two hidden css divs
 
i dont know how to use jquery =/

FirstSocialApps 16th December 2012 09:40 AM

Re: Need Javascript showing two hidden css divs
 
Quote:

Originally Posted by Christopherson (Post 7482296)
i dont know how to use jquery =/

I very strongly suggest you learn. JQUERY is going to make your Javascript tasks so much more easy.

jQuery: The Write Less, Do More, JavaScript Library


All times are GMT -6. The time now is 01:52 PM.