Hi,
I have 2 date fields the start and end date, then I have a table with field training status.
I want to display an error message when, Start date is less or equal to today and End date is less or equal to today, and training status is not Completed, The results I get from my code are not what I am expecting .
Your help will be highly appreciated.
//Fast Track Statuses $(document).ready(function() { // The startDate and endDate selectors. var $startDate = $("#Field8"); var $endDate = $("#Field9"); $startDate.add($endDate).on("change",function(){ //Create moment objects for the start, end, and current dates var startDate = moment($startDate.val()); var endDate = moment($endDate.val()); var currentDate = moment(); if ($(startDate <= currentDate && endDate <= currentDate) && (('.TrainingStatus input') != "Completed")) { alert('Warning! The training status does not match the dates.') //$('.TrainingStatus input').val('çompleted') } else { alert('Correct Training dates') } } ); });