如何在javascript中点击事件更改breadcrumb arrow css? [英] How to change breadcrumb arrow css on click event in javascript?

查看:86
本文介绍了如何在javascript中点击事件更改breadcrumb arrow css?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个箭头面包屑css,看起来像预期的那样。但是点击特定的菜单它是'

颜色应该改变。但在我的情况下,jquery不会更改border-left-color属性。



我跟随css,



.breadcrumb li:nth -child(2)a {

背景:绿色;

}



.breadcrumb li:nth-孩子(2)a:经过{

border-left-color:green;

}



And我的Jquery代码是,



 $( #CONFIGURE_POLICY_li)。click(function(){
$( .breadcrumb li:nth-​​child(2)a)。removeAttr(' background').css(' background'' 无重复滚动0 0红色); / * 它工作正常。* /
$( .breadcrumb li:nth- child(2)a:after)。removeAttr(' border-left-color')。css(' border-left-color'' red'); / * 虽然它不是。* /

});

解决方案

#CONFIGURE_POLICY_li)。click(function(){


(< span class =code-string> 。breadcrumb li:nth-​​child(2)a)。removeAttr(' background')。css(' background'' none repeat scroll 0 0 red'); / * 工作正常。* /


。breadcrumb li:nth-​​child(2)a:after)。removeAttr(' border-left-color')。css(' border -left-color'' red'); / * 虽然不是。* /

});


Hi, I have a arrow bread crumb css, which look as expected.But on click of particular menu it''s
color should be change.But in my case jquery doesn''t change border-left-color property.

I have follow css,

.breadcrumb li:nth-child(2) a {
background:green;
}

.breadcrumb li:nth-child(2) a:after {
border-left-color:green;
}

And my Jquery code is,

$("#CONFIGURE_POLICY_li").click(function () {
              $(".breadcrumb li:nth-child(2) a").removeAttr('background').css('background','none repeat scroll 0 0 red');/*It works fine.*/
              $(".breadcrumb li:nth-child(2) a:after").removeAttr('border-left-color').css('border-left-color','red');/*while it is not.*/

          });

解决方案

("#CONFIGURE_POLICY_li").click(function () {


(".breadcrumb li:nth-child(2) a").removeAttr('background').css('background','none repeat scroll 0 0 red');/*It works fine.*/


(".breadcrumb li:nth-child(2) a:after").removeAttr('border-left-color').css('border-left-color','red');/*while it is not.*/ });


这篇关于如何在javascript中点击事件更改breadcrumb arrow css?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆