Hello,
is there a way to parse every fieldset nested inside a tab and expand/collapse it using javascript ?
Thank you very much.
Romalex.
Expand/Collapse all fieldsets nested in a tab of a tabview
Hi,
my own answer, if this can help :
Best regards.
Romalex
my own answer, if this can help :
Code: Select all
function expandAllFld(callerElement){
var form = callerElement.form;
var allFsets = form.getElementsByTagName('fieldset');
var fset = null;
var input = null;
var span = null;
var div = null;
if (callerElement.checked){
//Expand all fieldsets
for (var i=0; i<allFsets.length; i++)
{
fset = allFsets[i];
input = fset.getElementsByTagName('input');
if (input[0].value == 'true') {
input[0].value = 'false';
div = fset.getElementsByTagName('div');
div[0].style.display = '';
span = fset.getElementsByTagName('span');
span[0].className = "ui-fieldset-toggler ui-icon ui-icon-minusthick";
}
}
}
else {
//Collapse all fieldsets
for (i=0; i<allFsets.length; i++)
{
fset = allFsets[i];
input = fset.getElementsByTagName('input');
if (input[0].value == 'false') {
input[0].value = 'true';
div = fset.getElementsByTagName('div');
div[0].style.display = 'none';
span = fset.getElementsByTagName('span');
span[0].className = "ui-fieldset-toggler ui-icon ui-icon-plusthick";
}
}
}
}
Romalex
-
- Prime
- Posts: 18616
- Joined: 05 Jan 2009, 00:21
- Location: Cybertron
- Contact:
Fieldset also has simpler client side api method called widgetVar.toggle().
-
- Information
-
Who is online
Users browsing this forum: No registered users and 33 guests