首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JQuery -选择器的问题(同级、父级...)

JQuery -选择器的问题(同级、父级...)
EN

Stack Overflow用户
提问于 2011-01-24 22:35:48
回答 1查看 458关注 0票数 1

我得到了一个coldfusion查询,其中结果按国家/地区名称分组。单击此按钮,我会尝试打开或关闭该国家/地区下的列表。但是我不能和这对兄弟姐妹和这对父母一起工作。结果是,如果我单击一个国家/地区名称,例如第四个国家/地区名称,它将关闭所有的孩子,以及之前的三个国家/地区名称。有人能帮我选择正确的选择器吗?先谢谢你,米歇尔

代码:

代码语言:javascript
复制
<script type="text/javascript" language="javascript">  
    $(document).ready(function(){
        var toggleMinus = '<cfoutput>#variables.strWebAddress#</cfoutput>/images/bullet_toggle_minus.png';
        var togglePlus = '<cfoutput>#variables.strWebAddress#</cfoutput>/images/bullet_toggle_plus.png';
        var $subHead = $('table#categorylist tbody th:first-child');
        $subHead.prepend('<img src="' +toggleMinus+ '" alt="collapse this section" />&nbsp;');
        $('img', $subHead).addClass('clickable').click(function(){
            var toggleSrc = $(this).attr('src');
            if(toggleSrc == toggleMinus){
               $(this).attr('src',togglePlus).parents('.country').siblings().fadeOut('fast');
            }else{
              $(this).attr('src',toggleMinus).parents('.country').siblings().fadeIn('fast');
            }
        });
     }); 
</script>

<table width="95%" border="0" cellspacing="2" cellpadding="2" align="center id="categorylist"> 
<thead>
    <tr>
        <th class="text3" width="15%">
            <cfmodule template="../custom_tags/get_message.cfm" keyName="L_ACTOR_CODENUMBER">
        </th>
        <th class="text3" width="15%">
            <cfmodule template="../custom_tags/get_message.cfm" keyName="L_ACTOR_CODE">
        </th>
        <th class="text3" width="55%">
            <cfmodule template="../custom_tags/get_message.cfm" keyName="L_ACTOR_NAME">
        </th>
        <th class="text3" width="15%">
            <cfmodule template="../custom_tags/get_message.cfm" keyName="L_ACTIVE">
        </th>
    </tr>
</thead>
<tbody id="content">
<cfoutput query="qryCategoryUrl" group="country_name" groupcasesensitive="false">
    <tr class="country">
        <th style="font-weight:bold; text-align:left;" colspan="4">#country_name#</th>
    </tr>
<cfoutput>
    <tr>
        <td valign="top" class="text3">#Replace(ACTOR_CODENUMBER, Chr(13) & Chr(10), "<br>", "ALL")#&nbsp;</td>
        <td valign="top" class="text3">#Replace(ACTOR_CODE, Chr(13) & Chr(10), "<br>", "ALL")#&nbsp;</td>
        <td valign="top" class="text3">#Replace(ACTOR_NAME, Chr(13) & Chr(10), "<br>", "ALL")#&nbsp;</td>
        <td valign="top" class="text3"><cfmodule template="../custom_tags//get_message.cfm" keyName="#ACTIVE_display(qryCategoryUrl.ACTIVE)#"></td>
    </tr>
</cfoutput>
</cfoutput>
</tbody>
</table>
EN

回答 1

Stack Overflow用户

发布于 2011-01-25 22:58:02

哇,所有这些cfmodule的使用,cfmodule都会占用大量的内存。

尽管我总是建议人们在任何浏览器中尝试他们的页面,并使用http://www.selectorgadget.com/的SelectorGadget书签小程序

这使得测试和检查正确的选择器变得更容易,以满足您的应用程序需求。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/4783223

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档