Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/407.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用javascript和jquery获取可折叠面板_Javascript_Jquery_Asp.net - Fatal编程技术网

使用javascript和jquery获取可折叠面板

使用javascript和jquery获取可折叠面板,javascript,jquery,asp.net,Javascript,Jquery,Asp.net,大家好,我正在尝试使用jquery和javascript获取CollapsablePanelExtender,下面是我的代码: function ExpandCollapse() { debugger; var collPanel = $find("#<%=countries.ClientID %>"); } 单击按钮时,我调用此函数,但面板始终为空,我所做的是否正确?如果是的话,请您帮助解释一下为什么这是空的 countries是一个具有r

大家好,我正在尝试使用jquery和javascript获取CollapsablePanelExtender,下面是我的代码:

function ExpandCollapse()
    {
        debugger;
        var collPanel = $find("#<%=countries.ClientID %>");
}
单击按钮时,我调用此函数,但面板始终为空,我所做的是否正确?如果是的话,请您帮助解释一下为什么这是空的

countries是一个具有runat=server属性的可折叠PanelExtender

提前谢谢\

亲切问候。

试试看

var $collPanel = $('#<%=countries.ClientID %>');

如果面板的ID=cpe1,则

var p = $find("cpe");
if (p != null) {
    if (p.get_Collapsed()) ... do what you want when it is collapsed
    else ... it's not collapsed.
}

向可折叠面板添加一个ID,例如:,然后使用简单的jQuery:var cpanel=$'cpe'查找它;countries是我的可折叠PanelExtender的id。我在没有客户的情况下用它试过。还是不走运。字符串“countries”是id?比如在ID=国家?若有,"国家";;必须工作…请尝试删除哈希标记$findcountries@johnnie显示生成的html
var p = $find("cpe");
if (p != null) {
    if (p.get_Collapsed()) ... do what you want when it is collapsed
    else ... it's not collapsed.
}