jQuery 更改引导程序日期选择器的文本或背景颜色
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/27229771/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Change text or background color of bootstraps date picker
提问by Marcus
I have implemented the bootstrap date picker (see figure below). It's working as intended. The code look like this:
我已经实现了引导日期选择器(见下图)。它按预期工作。代码如下所示:
<div class="input-group date">
<input name="departure" type="text" class="form-control" id="departure" required>
<span class="input-group-addon">
<i data-time-icon="icon-time" data-date-icon="icon-calendar"></i>
</span>
</div>
The code for implementing the date picker:
实现日期选择器的代码:
$(document).ready(function () {
$('.input-group.date').datepicker({
format: "yyyy/mm/dd",
startDate: "2014-12-01",
endDate: "2016-01-01",
todayBtn: "linked",
autoclose: true,
todayHighlight: true
});
});
Date picker:
日期选择器:
When I change the background color of my HTML page like this:
当我像这样更改 HTML 页面的背景颜色时:
body {
background: #EDEDED !important; /* RGB Decimal :237, 237, 237 */
color: #965B25 !important; /* RGB Decimal :150, 91, 37 */
}
The text in the date picker is also changed. The result of this is that you can not read any text inside the date picker box. Is there a way to change the text color/background color of the date picker itself?
日期选择器中的文本也发生了变化。这样做的结果是您无法读取日期选择器框中的任何文本。有没有办法更改日期选择器本身的文本颜色/背景颜色?
Any help is greatly appriciated.
任何帮助都非常有用。
Marcus
马库斯
回答by asdf_enel_hak
try this:
尝试这个:
.datepicker {
background-color: #fff ;
color: #333 ;
}
回答by Shravan Ramamurthy
The same issue i faced for Bootstrap3 datetimepicker and i did the below change and it worked
我在 Bootstrap3 datetimepicker 中遇到的同样问题,我做了以下更改并且它起作用了
$('.datepicker').on(
'dp.show',
function(e) {
$(".bootstrap-datetimepicker-widget").css(
"background-color", "#3c3e43");
});