我正在创建一个 JIRA 自定义字段插件,并希望使用下面的“日期时间选择器”控件作为下面链接中给出的“月年选择器”。 http://jquerybyexample.blogspot.com/2012/06/show-only-month-and-year-in-jquery-ui.html
JIRA 版本是“5.2.11”
速度模板中的 JQUERY 控制 STUFF:
<script type="text/javascript">
alert("Handler for .click() called."); //get alert
AJS.$("#target").click(function() { //get alert while click on below "target" div.
alert("Handler for .click() called.");
});
AJS.$(document).ready(function () {
AJS.$('#txtDate').datepicker({ //shows javascript error as"[object Object] has no method 'datepicker' "
changeMonth: true,
changeYear: true,
dateFormat: 'MM yy',
onClose: function () {
var iMonth = AJS.$("#ui-datepicker-div .ui-datepicker-month :selected").val();
var iYear = AJS.$("#ui-datepicker-div .ui-datepicker-year :selected").val();
AJS.$(this).datepicker('setDate', new Date(iYear, iMonth, 1));
},
beforeShow: function () {
if ((selDate = AJS.$(this).val()).length > 0) {
iYear = selDate.substring(selDate.length - 4, selDate.length);
iMonth = jQuery.inArray(selDate.substring(0, selDate.length - 5), AJS.$(this).datepicker('option', 'monthNames'));
AJS.$(this).datepicker('option', 'defaultDate', new Date(iYear, iMonth, 1));
AJS.$(this).datepicker('setDate', new Date(iYear, iMonth, 1));
}
}
});
});
alert('final'); // not alert as error at above code
</script>
javascript错误如下:
"TypeError: Object [object Object] 没有方法'datepicker' [
http://localhost:2990/jira/s/en_US1rk3us/787/3/1/_/download/superbatch/js/batch.js:9919
"
任何想法,我如何使用这个控件来自定义场速度模板并开始工作?