jQuery datepicker选择日期未分配值 [英] Jquery datepicker selected date not assigning the value

查看:92
本文介绍了jQuery datepicker选择日期未分配值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与选择器相关联的日期选择器,用于选择日期.但是,当我选择日期时,选择内容将显示在编辑器字段中,但未将值分配给各个元素.

I have a date picker associated with an editor field for selecting the date. But when i select the date, the selection is showing in the editor field but the value is not getting assigned to the respective element.

我的代码如下:

jQuery:

$("#JobDate").click(function () {
    $(this).datepicker({ dateFormat: 'dd/mm/yy' }).datepicker("show");
});

cshtml代码

<tr class="spaceUnder">
    <td>@Html.LabelFor(model => model.JobDate)</td>
    <td>@Html.EditorFor(model => model.JobDate)</td>
</tr>

我也想听听您对这一方法的看法.也欢迎使用其他方法.

I would also like to hear your approach on this one. Alternative methods are also welcome.

推荐答案

尝试使用

$('#JobDate").datepicker({
    //your configuration here
});

这会分配处理程序以在您选择日期时处理输入值的设置.

This assigns handlers to handle setting the value of your input when you select a date.

这篇关于jQuery datepicker选择日期未分配值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆