如何检查jQuery datepicker是否为空? [英] How check if jQuery datepicker is empty?
本文介绍了如何检查jQuery datepicker是否为空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个日期选择器为空,但我不知道如何检查是否为空(未被验证)
I have a date picker empty, but I do not know how to check if is empty (not validated or not)
推荐答案
p>您可以使用 .val()$ c $检查输入的值c>
,如下所示:
You can check the value of the input using .val()
, like this:
if($("#fieldID").val() == "") {
alert("no date selected");
}
或者用于内联日期戳记,如此,请使用 getDate
,返回 null
如果没有选择:
Or for inline datepickers and such as well, use getDate
which returns null
if there's nothing selected:
if($("#fieldID").datepicker("getDate") === null) {
alert("no date selected");
}
这篇关于如何检查jQuery datepicker是否为空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文