使用jQuery更新CSS [英] Update css using jQuery
本文介绍了使用jQuery更新CSS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用jQuery更新导航栏的CSS.
I am trying to update the css of my navbar using jQuery.
通常将CSS定义为的位置:
Where you would normally define the css as:
.navbar-static-top .navbar-nav > .active > a{
background-color: black;
}
我如何使用类选择器(无需单独键入每个元素)?
What do I use for the class selector (without typing each element individually)?
$(".navbar-static-top .navbar-nav > .active > a").css({"background-color": "black"});
推荐答案
尝试使用查找
jQuery(".navbar-static-top .navbar-nav").find(".active").find("a").css("background-color","#000");
谢谢!
这篇关于使用jQuery更新CSS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文