Validate that end date is greater than start date with jQuery

前端 未结 15 1664
隐瞒了意图╮
隐瞒了意图╮ 2020-11-22 13:14

How do I check/validate in jQuery whether end date [textbox] is greater than start date [textbox]?

15条回答
  •  清酒与你
    2020-11-22 13:39

    var startDate = new Date($('#startDate').val());
    var endDate = new Date($('#endDate').val());
    
    if (startDate < endDate){
    // Do something
    }
    

    That should do it I think

提交回复
热议问题