jQuery Datepicker 中的今天按钮不起作用 [英] Today button in jQuery Datepicker doesn't work

查看:27
本文介绍了jQuery Datepicker 中的今天按钮不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 jQueryUI Datepicker 并显示今天"按钮.但它不起作用.它在演示中也不起作用:http://www.jqueryui.com/demos/datepicker/#buttonbar

I'm using jQueryUI Datepicker and show "Today" button. But it doesn't work. It also doesn't work in demo: http://www.jqueryui.com/demos/datepicker/#buttonbar

我想在按下这个按钮时用今天来填充输入.

I'w want to fill input with today when press this button.

是否可以让它工作?

推荐答案

他们的代码并没有真正损坏.它只是没有做大多数人期望它做的事情.即在输入框中输入今天的日期.它的作用是突出显示用户在日历上查看今天的日期.如果他们在另一个月或另一年关闭,则日历会弹回今天的视图,而不会取消选择用户已选择的日期.

Their code is not really broken. It just doesn't do what most people would expect it to do. Which is to enter today's date into the input box. What it does do, is highlight for the user to see today's date on the calendar. If they were off in another month or another year, the calendar pops back to today's view without deselecting the date the user already selected.

为了更直观,您需要更新插件代码以满足您的需求.让我知道进展如何.

To make it more intuitive, you'll need to update the plugin code to suit your needs. Let me know how it goes.

您需要获取未压缩版本的 jquery-ui javascript.我正在查看 1.7.2 版,_gotoToday"函数在第 6760 行.只需在 _gotoToday 中添加一个调用,它会在第 6831 行触发 _selectDate() 函数.:) 快乐编码.

You'll need to get the uncompressed version of the jquery-ui javascript. I'm looking at version 1.7.2 and the "_gotoToday" function is on line 6760. Just add a call into that _gotoToday that fires off the _selectDate() function on line 6831. :) Happy Coding.

这篇关于jQuery Datepicker 中的今天按钮不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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