I have have two div
s. I want to display a div
( which has other div
s inside it ) when the onclick
event is triggered.
Any help or suggestion would be appreciated.
This question is related to
javascript
html
css
function showstuff(boxid){
document.getElementById(boxid).style.visibility="visible";
}
<button onclick="showstuff('id_to_show');" />
This will help you, I think.
You'll have to give an ID to the div you want to show/hide, then use this code:
html:
<div id="one">
<div id="tow">
This is text
</div>
<button onclick="javascript:showDiv();">Click to show div</button>
</div>
javascript:
function showDiv() {
div = document.getElementById('tow');
div.style.display = "block";
}
CSS:
?#tow { display: none; }?
Fiddle: http://jsfiddle.net/xkdNa/
If you have the ID of the div, try this:
<input type='submit' onclick='$("#div_id").show()'>
Source: Stackoverflow.com