Home  >  Article  >  Web Front-end  >  EasyUI Datebox date verification start date is less than end time example sharing

EasyUI Datebox date verification start date is less than end time example sharing

小云云
小云云Original
2018-01-11 14:36:322574browse

This article mainly introduces the EasyUI Datebox date verification that the start date is less than the end time. Friends who need it can refer to it. I hope it can help everyone.

Effect

Create date box


<p style="width:65px;"><label>选择时间:</label></p>
<p style="width:100px;" id="StartsTime">
   <p class="easyui-datebox" name="data" id="StartDate" style="height:26px;width:100px "></p>
 </p>
 <pstyle="width:110px;" id="EndTime">
   -
  <p class="easyui-datebox" type="text" name="data" id="EndDate" style="height:26px;width:100px " validType="end"></p>
</p>

Custom easyui verification


//验证开始时间小于结束时间 
$.extend($.fn.validatebox.defaults.rules, {
  end: {
    validator: function (value, param) {
      var startDate = $("#StartsTime input").val();
      var startTmp = new Date(startDate.replace(/-/g, "/"));
      var endTmp = new Date(value.replace(/-/g, "/"));
      return startTmp <= endTmp;
    },
    message: &#39;结束时间要大于开始时间!&#39;
  }
})

Related recommendations:

How to solve the problem of hidden or unavailable Easyui-Datebox settings

jQuery EasyUI API Chinese Documentation - DateBox Date Box

jQuery EasyUI API Chinese Documentation - DateBox Date Box_PHP Tutorial

The above is the detailed content of EasyUI Datebox date verification start date is less than end time example sharing. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn