1

I am using bootstrap datepicker and my required is to select the weekly. So i had wrote these two css..

.datepicker-dropdown .datepicker-days tr:has("td.active") {
    background-color: green;
    color: yellow;
}
.datepicker-dropdown .datepicker-days tr:hover td.weekly{
    background-color: #808080;
}

In above code hover is working on placing the cursor. where as after selecting the entire tr is not highlighting even though td has active class. I tried the same in jQuery which is working fine, below is the jquery code

.datepicker-dropdown .datepicker-days tr.selectedWeek {
    background-color: green;
    color: yellow;
}

$(".datepicker-dropdown .datepicker-days tr:has(> td.weekly.active)").each(function() {
    $(this).addClass("selectedWeek");
});

But i want to know how to do it in css?

rrk
  • 15,677
  • 4
  • 29
  • 45

1 Answers1

1

Unfortunately, there is no way to target the parent element in css. See this: https://css-tricks.com/parent-selectors-in-css/