Could anyone tell me how I can use this code to show and hide data between DIV`s (not to hide and show - I want the other way)?
I`m using in .js file:
function toggle(sDivId) {
var oDiv = document.getElementById(sDivId);
oDiv.style.display = (oDiv.style.display == "none") ? "block" : "none";
}
And in .php file:
<div onclick="toggle('divContent1')" style="cursor: pointer;">Hide and show</div>
<div id="divContent1">
text here
</div>
</div>
This code is working just fine but when the page is loading I wish to have text already hidden (not after when I click "Hide and show" text).
Thanks!