【问题标题】:jquery datepicker only month and yearjquery datepicker 只有月份和年份
【发布时间】:2012-09-23 15:09:02
【问题描述】:

我有两个问题:

  1. “今天”按钮不起作用,因为日历未使用所选值初始化,并初始化当前月份。

  2. 我需要为按钮“完成”覆盖 onclick - 怎么做?

脚本:

$('.datefield_month').datepicker({
            changeMonth: true,
            changeYear: true,
            showButtonPanel: true,
            dateFormat: 'MM, yy',
            onClose: function (dateText, inst) {
                var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
                var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
                $(this).val($.datepicker.formatDate('MM, yy', new Date(year, month, 1)));
            }
        });

查看:

<input name = "Month" class = "datefield_month" value="@Model.Month.ToString("Y", Session["culture"] as CultureInfo)" type="text" id ="Month" />

【问题讨论】:

    标签: jquery asp.net-mvc-3 datepicker


    【解决方案1】:

    这篇博客http://jquerybyexample.blogspot.co.uk/2012/06/show-only-month-and-year-in-jquery-ui.html?m=1 讨论了如何实现类似的。我们在一些项目中使用了技术

    【讨论】:

      猜你喜欢
      • 2011-08-14
      • 1970-01-01
      • 1970-01-01
      • 2020-08-27
      • 2011-10-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多