I have a webpage that contains ASP.NET panels and JavasScript that expands and collapses them when the user clicks the expand/collapse all button. I want to exclude some panels so they don’t get expanded or collapsed when the user clicks the button (they are contained in a user control and appear as nested panels).
I have the following JavaScript:
function expandCollapsePanels()
{
var collapse = $('#<%= lbltogglePanels.ClientID %>').html() == "Collapse all panels";
var panels = Sys.Application.getComponents();
for (var i in panels)
{
//if panel name/ID contains 'pnlDetails', remove it (or don't collapse/expand it)
panels[i].set_Collapsed(collapse);
}
}
How can I modify this code to remove panels that contain ‘pnlDetails’ as part of their ID(or element name)?
Do you mean something like this?