我有这个jQuery:
$(".utente1").click(function () {
$('.newdiv').hide();
$('.hidecolor').find('.vc_single_image-img').css('filter','grayscale(100%)');
$(".utente-1").show(600);
$('.utente1').find('.img').css('filter','none')
})
当我点击另一个按钮时,按钮utente1重新生成过滤器:无
当我点击.utente1时,它会打开div,但我希望按钮(.utentel)也能更改颜色。
在utente1中添加此代码点击:
$(this).css('color','red');
所以你的完整代码是:
$(".utente1").click(function () {
$('.newdiv').hide();
$(".utente-1").show(600);
$(this).css('color','red');
});
如果您想更改所有按钮的颜色。为这些按钮添加一个comman类,然后设置css:
$(".utente1").click(function () {
$('.newdiv').hide();
$(".utente-1").show(600);
$(".commanClass").css('color','red');
});