我发现datetimepicker默认z-index
是1
,但对我的网站我需要z-index
9999
。我已经改变了点击处理程序中的jquery的值,但它只能在第一次点击时起作用。连续点击不起作用。为什么是这样?如何在每次点击时更改datetimepicker的z-index?
<td style="height: 40px;">
<input type="text" class="datetimepicker" name="sdate" placeholder="Start Date" style="height: 39px; width: 260px;">
</td>
<td style="height: 40px;">
<input type="text" class="datetimepicker" name="edate" placeholder="End Date" style="height: 39px; width: 260px;">
</td>
$(document).ready(function() {
$('.datetimepicker').on('click', function(e) {
e.preventDefault();
$(this).datetimepicker({
dateFormat: "yy-mm-dd",
showTimezone: false,
maskInput: true,
timeFormat: "HH:mm:ss"
}).focus();
$('#ui-datepicker-div').css("z-index", 9999); //this is once time work
});
});
在CSS中设置'z-index'值 –
是否尝试在css中设置'z-index',如果不起作用,则意味着每次打开'datetimepicker'时,它都会被重置它的'z-index'设置为'1',尝试调查更多 –