JQuery - 如何选择特定的DIV

标签 jquery jquery-ui

好吧,我只是想切换这个 DIV .. 还有更多的 DIV 遵循这个 HTML 结构。输入容器和输入扩展正在工作,因为它们适本地切换..

如何切换内部 div.header-image-open 和 div.header-image-close?我感谢任何可以提供帮助的人!

 $(".input-header").click(function()
      {     
        $(this).next(".header-image-open").toggle();
        $(this).next(".header-image-close").toggle();
        $(this).next(".input-container").slideToggle(600);
        $(this).next(".input-container").next(".input-expand").slideToggle(600);

      });
<div class="input-header">
    <div class="header-text"><h2 class="arial">Carat</h2></div>
    <div class="header-image-open"><img src="/images/icons/expand-open.gif" /></div>
    <div class="header-image-close"><img src="/images/icons/expand-close.gif" /></div>
</div> 
<div class="input-container" style="height: 70px;">
   Content
</div>
<div class="input-expand">
    <p>Click to expand the color filter</p>
</div>

最佳答案

你可以尝试:

 $(".input-header").click(function()
  {     
    $(this).find(".header-image-open,.header-image-close").toggle();
    $(this).next(".input-container").slideToggle(600);
    $(this).next(".input-container").next(".input-expand").slideToggle(600);
  });

关于JQuery - 如何选择特定的DIV,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1402456/

相关文章:

jquery - 鼠标移出时清除多边形

javascript - 'Error: uncaught exception: Syntax error, unrecognized expression: [object Object]' 在 jQuery 中意味着什么?

jQuery 自动完成 : On select parse other key from the same array

javascript - jQuery UI switchClass() 无法正常工作

javascript - 如何使 JQuery 模态关闭按钮更大

javascript - Jquery 自动完成功能不起作用 - 没有搜索结果

javascript - var functionName = function() 不是函数

jquery - 从 API 反序列化嵌套 json

javascript - 将过滤器选择器变量传递给另一个函数

javascript - 如何捕获Angular中附加点击的模型值?