Jquery datepicker beforeShow似乎没有传递实例 [英] Jquery datepicker beforeShow doesn't seem to be passing the instance

查看:373
本文介绍了Jquery datepicker beforeShow似乎没有传递实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是JS小提琴:

http:// jsfiddle.net/UEnqL/

$("#datepicker").datepicker({ dateFormat: 'dd/mm/yy', beforeShowDay: myFunction});

function myFunction(input, inst)
{
    alert(inst);
}

根据文档: http://docs.jquery.com/UI/API/1.8/Datepicker#event-beforeShow

beforeshowDay 方法接受输入和输入。总是看起来似乎没有定义。这是一个让我感到悲伤的事情,因为我需要抓住datepicker本身。

the beforeshowDay method accepts input and inst. inst always seems to be undefined though. This is causing me some grief as I need to get hold of the datepicker itself.

有没有解决方法?

推荐答案

beforeshowDay 回调只有一个参数; 日期对象。 beforeShow 回调但是有两个参数,如你所提到的。

The beforeshowDay callback has only one argument; a date object as per documentation. the beforeShow callback however has 2 arguments as you've mentioned.

beforeShowDay - http://docs.jquery.com/UI /API/1.8/Datepicker#event-beforeShowDay

查看这个演示 http://jsfiddle.net/UEnqL/6/

正如你所看到的, beforeShow 回调正确地传递到元素和实例中。 beforeshowDay 只传递一个日期对象。

As you can see, the beforeShow callback correctly passes in the element and the instance. The beforeshowDay passes in just a date object.

这篇关于Jquery datepicker beforeShow似乎没有传递实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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