jQuery UI Datepicker:在标签问题下面对齐 [英] jQuery UI Datepicker: Align below label issue
本文介绍了jQuery UI Datepicker:在标签问题下面对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在标签(< span>
)上使用jQuery Datepicker而不是输入字段。这是代码:
I'm trying to use jQuery Datepicker on a label (<span>
) instead of an input field. Here's the code:
// javascript
$('#placeholder').datepicker({
changeMonth: true,
changeYear: true,
showMonthAfterYear: true,
showOn: 'button',
buttonText: 'set',
dateFormat: 'd-M-y',
onSelect: function(dateText, inst) {
var date = $(this).datepicker('getDate');
var epoch = date.valueOf() / 1000;
$('#value').val(epoch);
$('#label').text(dateText);
}
});
(function() {
var initial = 1297800000;
var $label = $('#label');
if (initial == '' || initial == '0') {
$label.text('not set');
} else {
var date = new Date(initial * 1000);
$label.text($.datepicker.formatDate('d-M-y', date));
}
})();
<!-- html -->
<span id="label" /><:input_nulldate></span>
<input type="hidden" id="placeholder" />
<input type="hidden" id="value" />
但我无法在< span>下弹出窗口
。它不断弹出按钮。如何使其正确对齐?
But I can't get it to popup under the <span>
. It keeps popping up over the button instead. How can I get it to align correctly?
推荐答案
您可以使用css移动框。例如:
You can move the box around using css. For instance:
.ui-datepicker {
margin-left: -80px;
margin-top: 40px
}
会得到它关于你想要的地方。
Will get it about where you want it.
这篇关于jQuery UI Datepicker:在标签问题下面对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文