I'm hiding and showing the contents inside fieldset on click of legend.
JSFIDDLE Example
var legends = document.getElementsByTagName("legend");
for(var i=0; i<legends.length; i++)
{
legends[i].onclick = function()
{
var myDivs = this.parentNode.getElementsByTagName("div");
var myDiv;
if(myDivs.length > 0)
{
var myDiv = myDivs[0];
if(myDiv.style.display == "")
{
myDiv.style.display = "none"
}
else
{
myDiv.style.display = "";
}
}
}
}
How do i prevent pusing after showing the contents? In my example Sample content is pushed down after the contents are shown. How to overlap div contents?
I would suggest showing it in a popup if you are using jquery. Try this code in the html and make sure you reference jquery mobile:
jsfiddle: https://jsfiddle.net/UHn6q/51/