[英]how to style CSS for Js daterangepicker after start date and end date is selected?
I want to style my DateRangePicker
in a way that once I have selected the start-date
and end-date
then all the <td>
tag between these two dates are styled with我想设置我的
DateRangePicker
的样式,一旦我选择了start-date
和end-date
,那么这两个日期之间的所有<td>
标记都使用
background-color:red
Problem: I only want to style all <td>
tag once I have selected start-date and end-date .问题:一旦我选择了start-date和end-date ,我只想设置所有
<td>
标记的样式。
When I select the start-date
I get the classes available, active and start-date
.当我 select
start-date
时,我得到了可用的课程,活动和start-date
。 When I select the end-date
I get the classes available, active and end-date
.当我 select
end-date
,我得到了可用的课程,活动和end-date
。 all the <td>
in between have classes .available
, .in-range
之间的所有
<td>
都有类.available
, .in-range
if I style using classes .start-date
, .in-range
and .end-date
it change the background-color
when I hover over <td>
after selecting start date because it gets the class .in-range
while hovering.如果我使用类
.start-date
, .in-range
和.end-date
设置样式,当我在选择开始日期后 hover 超过<td>
时,它会更改background-color
,因为它在悬停时获得 class .in-range
。
<tr>
<td class="weekend available" data-title="r1c0">5</td>
<td class="active start-date available" data-title="r1c1">6</td>
<td class="in-range available" data-title="r1c2">7</td>
<td class="in-range available" data-title="r1c3">8</td>
<td class="in-range available" data-title="r1c4">9</td>
<td class="in-range available" data-title="r1c5">10</td>
<td class="weekend in-range available" data-title="r1c6">11</td>
</tr>
<tr>
<td class="weekend in-range available" data-title="r2c0">12</td>
<td class="in-range available" data-title="r2c1">13</td>
<td class="in-range available" data-title="r2c2">14</td>
<td class="active end-date in-range available" data-title="r2c3">15</td>
<td class="available" data-title="r2c4">16</td>
<td class="available" data-title="r2c5">17</td>
<td class="weekend available" data-title="r2c6">18</td>
</tr>
This is the code for when I have selected the start date as 6 and end-date as 15.这是我选择开始日期为 6 和结束日期为 15 时的代码。
I can not style like:我不能像这样:
.start-date, .in-range, .end-date{
background-color: "red";
}
because by default after selecting start date when I hover over other dates it gets the class .in-range
.因为默认情况下,当我选择开始日期后,当我 hover 超过其他日期时,它会得到 class
.in-range
。
How can I style it using css
, js
or jquery
?如何使用
css
、 js
或jquery
对其进行样式设置?
This worked for me, I hope three years later it is not too late;-)这对我有用,我希望三年后还为时不晚;-)
.daterangepicker td.in-range {
color: #ffffff;
background-color: #a12727;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.