关于easyUI的datebox加失去焦点事件即click、blur等

想实现日期框easyui-datebox手动输入值,手动输入失去焦点判断输入值是否合法 

例如<input id="txtDate" type="text" class="easyui-datebox" />  直接$("#txtDate").blur(){}没有反应。因为加载日期控件dom的时候多了很多其他控件所以定位具体控件的时候有点问题。

经自己测试和大神解答,发现有两种方法,直接上代码(简单测试例,没有写判断日期是否合法):

<!DOCTYPE html>
<html>
<head>
<script src="jquery-1.7.2.min.js"></script>
<script src="jquery.easyui.min.js"></script>
<link href="easyui.css" rel="stylesheet" type="text/css" />
</head>

<body>
 <input id="txtDate" type="text" class="easyui-datebox" />  

</body>

</html>
<script>
    $(function () {
        //自己测试
        $("#txtDate").next("span").children(":first").blur(function(){
            alert($("#txtDate").datebox('getValue'));
        });
        //大神提供
        $("#txtDate").datebox("textbox").blur(function(){
            alert($("#txtDate").datebox('getValue'));
        });
    });
</script>
原文地址:https://www.cnblogs.com/minzhousblogs/p/5474373.html