如何使用Java脚本清除日历输入
单击清除按钮
function resetTime() {
document.getElementById("to_time").valueAsDate = null;
}
PrimeFaces日历标签后的JavaScript功能
<p:calendar id="to_time"
value="#{anomaliesList.toDate}"
readonlyInput="true"
maxdate="#{currentDate}"
size="16"
pattern="dd/MM/yyyy HH:mm" />
JavaScript function after clicking on clear button
function resetTime() {
document.getElementById("to_time").valueAsDate = null;
}
PrimeFaces calendar tag
<p:calendar id="to_time"
value="#{anomaliesList.toDate}"
readonlyInput="true"
maxdate="#{currentDate}"
size="16"
pattern="dd/MM/yyyy HH:mm" />
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,
p:日历
被弃用。使用p:datePicker
而不是。处理此问题的最简单方法是在
p:datePicker
上设置widgetvar
。这允许您使用。要重置日期,请使用:
请注意,如果要使用
getElementById
,则可能需要合并表单clientId。另请参见:
First of all,
p:calendar
is deprecated. Usep:datePicker
instead.The easiest way to deal with this is setting a
widgetVar
on yourp:datePicker
. This allows you to use the client side API.To reset a date, use:
Note that if you want to use
getElementById
you probably need to incorporate the form clientId.See also: