When we declare the java script the validation not applied and not fired an error wile the is same as input type i have declared the code in php file.
I have used Xammp server
, running MySQL 5
, PHP 7.6.2
and Apache 2
.
<script type="text/javascript">
//Validation for Stratdate & Enddate for New Ticket creation form
$("#tedate").change(function () {
var objFromDate = document.getElementById("tsdate").value;
var objToDate = document.getElementById("tedate").value;
var FromDate = new Date(objFromDate);
var ToDate = new Date(objToDate);
if(FromDate > ToDate )
{
alert("Due Date Should Be Greater Than Start Date");
document.getElementById("tedate").value = "";
return false;
}
});
</script>
start date
<input type='date' id="tsdate" class="form-control col-md-6" placeholder="mm-dd-yyyy" name="startdate">
due date
<input type='date' id="tedate" class="form-control col-md-6" placeholder="Enter Due Date" name="enddate" required />
I want validate due date is greater than start date