2015-09-11 57 views
0

我想我在这里错过了一些简单的东西,但我似乎无法让tr选择器在我正在构建的日期选择器中工作。我只想在表格行中应用一个简单的边框,以便日历显示为一个网格,但似乎无法让它弹起舞会。不能让jQuery datepicker tr类工作

任何想法??这里的日期选择器的副本:

http://jsfiddle.net/oakass/6tbqw8px/

HTML

<input type="text" id="from" placeholder="From"> 
<input type="text" id="to" placeholder="To"> 

jQuery的

(function ($) { 
$(function() { 

    $("#from").datepicker({ 
     numberOfMonths: 1, 
     firstDay: 1, 
     onClose: function (selectedDate) { 
      $("#to").datepicker("option", "minDate", selectedDate); 
     } 
    }); 


    $("#to").datepicker({ 
     numberOfMonths: 1, 
     firstDay: 1, 
     onClose: function (selectedDate) { 
      $("#from").datepicker("option", "maxDate", selectedDate); 
     } 
    }); 

}); 

})(jQuery); 

CSS

 .ui-datepicker { 
    width: auto; 
    height: auto; 
    font: 9pt'Lato', Arial, sans-serif; 
} 

.ui-datepicker a { 
    text-decoration: none; 
} 

.ui-datepicker table { 
    width: 100%; 
} 

.ui-datepicker-header { 
    color: #333; 
    font-weight: bold; 
    line-height: 50px; 
} 

.ui-datepicker-title { 
    text-align: center; 
} 

a.ui-datepicker-next:after { 
    display: inline-block; 
    font-family: FontAwesome; 
    content:"\f054"; 
    margin-right: 20px; 
} 

a.ui-datepicker-prev:before { 
    display: inline-block; 
    font-family: FontAwesome; 
    content:"\f053"; 
    margin-left: 20px; 
} 

.ui-datepicker-prev { 
    float: left; 
    background-position: center -30px; 
    cursor: pointer; 
} 

.ui-datepicker-next { 
    float: right; 
    background-position: center 0px; 
    cursor: pointer; 
} 

.ui-icon-circle-triangle-e, .ui-icon-circle-triangle-w { 
    display: none; 
} 

.ui-datepicker th { 
    color: #333333; 
} 

.ui-datepicker td span, .ui-datepicker td a { 
    display: inline-block; 
    font-weight: bold; 
    text-align: center; 
    width: 30px; 
    height: 30px; 
    line-height: 30px; 
    color: #333333; 
} 

.ui-datepicker-calendar .ui-state-hover { 
    background: #9e2316; 
    color: #fff; 
} 

Oli

+0

我想你错过了jQuery UI CSS [file](http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css),或者没有复制所有需要的样式从CSS文件的datepicker。 [演示](http://jsfiddle.net/Lf83agzf/) –

回答

2

将此添加到表border-collapse:collapse

现在当边框在tr上添加时应该显示。

example