jQuery技术::has()jquery无法正常工作

我正在尝试在我的网站上执行以下操作:

$(".post-index:has(.wp-post-image)").css("background", "#000"); 

Js小提琴示例工作正常: http : //jsfiddle.net/rami2929/4x4t9/

但它在我的演示网站上没有工作:

我想改变有图像的背景颜色框。 如何在我的演示网站上实现这一点?

任何建议将非常感激。

谢谢。

    它在DOM就绪函数之外,改变这个:

     $(function(){ $(".articleBox").click(function(){ window.location=$(this).find("a").attr("href"); return false; });  $('.articleBox').mouseover(function(){ var color = $(this).find("a, .text-h2").css("color"); $(this).find("a, .text-h2").css("color", "rgba(255, 156, 0, 0.8)"); $(this).mouseout(function(){ $(this).find("a, .text-h2").css("color", "rgb(51, 51, 51)"); }); }); });  $(".post-index:has(.wp-post-image)").css("background", "#000"); 

     $(function(){ $(".articleBox").click(function(){ window.location=$(this).find("a").attr("href"); return false; });  $('.articleBox').mouseover(function(){ var color = $(this).find("a, .text-h2").css("color"); $(this).find("a, .text-h2").css("color", "rgba(255, 156, 0, 0.8)"); $(this).mouseout(function(){ $(this).find("a, .text-h2").css("color", "rgb(51, 51, 51)"); }); });  $(".post-index:has(.wp-post-image)").css("background", "#000"); }); 

      以上就是jQuery教程分享:has()jquery无法正常工作相关内容,想了解更多jQuery开发(异常处理)及jQuery教程关注计算机技术网(www.ctvol.com)!)。

      www.ctvol.com true Article jQuery技术::has()jquery无法正常工作

      本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

      ctvol管理联系方式QQ:251552304

      本文章地址:https://www.ctvol.com/jquerytutorial/532223.html

      (0)
      上一篇 2020年12月21日 上午10:43
      下一篇 2020年12月21日 上午10:46

      精彩推荐