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

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

问题描述

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



我想在今天填写输入按此按钮。



是否可以让它工作?

解决方案

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



为了使其更直观,需要更新插件代码以满足您的需要。让我知道如何进行。



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


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.

Is it possible to get it working?

解决方案

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.

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天全站免登陆