首页 > 解决方案 > 如何在 beforeShowDay 中突出显示对象

问题描述

beforeShowDay如何突出显示对象中的值?

  1. jquery 日期选择器
beforeShowDay: function(date) {
  var date = $("#calendar").datepicker({
    dateFormat: 'yy-mm-dd'
  }).val();
  var date = highdate;
  console.log(highdate);
  console.log(hightext);
  var Highlight = highdate[date];
  var HighlighText = hightext[date];
  if (Highlight) {
    return [true, "Highlighted", HighlighText];
  } else {
    return [true, '', ''];
  }
}

2.highdate 对象

Object
0:"2018-04-04"
1:"2018-04-30"
__proto__:Object

3.hightext 对象

Object
0:"text1"
1:"text2"
__proto__:Object

4.css

.Highlighted a {
  background-color: Green !important;
  background-image: none !important;
  color: White !important;
  font-weight: bold !important;
  font-size: 12pt;
}

标签: javascriptjquerydatepickerjquery-ui-datepicker

解决方案


推荐阅读