从日期选择器的按钮面板中删除默认按钮
我想保留按钮面板,但我不想要“今天”或“完成”按钮
jquery:
$(document).ready(function () {
$(".datepicker").datepicker({
showOn: "button",
buttonText: "Date",
showButtonPanel: true
});
});
html:
<div>
<label for="start">Start</label>
<input id="start" type="text" class="datepicker"/>
</div>
<div>
<label for="end">End</label>
<input id="end" type="text" class="datepicker"/>
</div>
I want to keep the button panel but I do not want the 'Today' or 'Done' buttons
jquery:
$(document).ready(function () {
$(".datepicker").datepicker({
showOn: "button",
buttonText: "Date",
showButtonPanel: true
});
});
html:
<div>
<label for="start">Start</label>
<input id="start" type="text" class="datepicker"/>
</div>
<div>
<label for="end">End</label>
<input id="end" type="text" class="datepicker"/>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
更新
显然我提供的解决方案有点过时了。请参阅下面的答案以获取有效的修复:https://stackoverflow.com/a/24806307/959041
您应该添加该选项
使您可以
更新
删除按钮,但能够添加其他按钮,您可以使用
beforeShow
事件。所以你有类似的东西,请参阅 http://jqueryui.com/demos/datepicker/#buttonbar 用于文档
UPDATE
apparently the solution I provided is kinda outdated. Please see the answer below for a working fix: https://stackoverflow.com/a/24806307/959041
you should add the option
so you have
UPDATE
to remove the buttons but be able to add other buttons you can use the
beforeShow
event. So you have something likesee http://jqueryui.com/demos/datepicker/#buttonbar for the documentation
我刚刚接受了之前的答案并找到了如何使其工作,但这看起来很难看。
基本上我添加的是 setTimeout ,因为按钮窗格的内容似乎是在 beforeShow 事件之后呈现的:
http://jsfiddle。净/zEper/278/
I just took previous answer and found how to make it work, but this looks ugly.
Basically what I added is setTimeout as it seems that content of buttons pane is rendered after beforeShow event:
http://jsfiddle.net/zEper/278/