最近博文寫的有點多,每篇都是一兩個知識點,其實就是筆記了,哎,有點對不起看文章的大家。如果有空,必定重新整理一下。
說一下這個問題,就是寫js方法的時候,正常的
var str=$("#cehsi").val();獲取不到值,而我的標籤如下
<input style="width:15%;" type="text" name="ceshi" id="ceshi" class="easyui-datetimebox" required="required"/>
正常情況下,class屬性引用了easyui-datetimebox控件,所以按照官網的用法,要想獲取到值,應該用getValue,同樣設置值也可以用setValue。
var str=$("#ceshi").datebox("getValue");//可以獲取到值
var startTime=$("#BeginDate").datebox("getValue");
var start=new Date(startTime.replace("-","/"));
var endTime=$("#EndDate").datebox("getValue");
var end=new Date(endTime.replace("-","/"));
if(end<start){
$.messager.alert('提示','實施結束時間不能小於實施開始時間','question');
return false;
}
上面是用日期控件順帶寫了一個比較日期大小的方法。
當然這個問題肯定適應於多數的easyui控件的引用取值和設置值的問題。