I have below code which is not working.
var day = $("#day").val();
var week = $("#week").val();
var month = $("#month").val();
if (day > week) {
alert(day > week);
$('#error').text("Day Limit Must be smaller than Week Limit");
$('.alert-danger').show();
setTimeout(function () {
$(".alert-danger").hide();
}, 5000);
return false;
}
if (day > month) {
$('#error').text("Day Limit Must be smaller than Month Limit");
$('.alert-danger').show();
setTimeout(function () {
$(".alert-danger").hide();
}, 5000);
return false;
}
if (month < week) {
$('#error').text("Week Limit Must be smaller than Month Limit and greater than Day Limit");
$('.alert-danger').show();
setTimeout(function () {
$(".alert-danger").hide();
}, 5000);
return false;
}
Here i am getting day=4 and week=6 and month=9. In this case all if conditions are working fine. But month=10, second if condition not working (4>10) is actually false but it getting true.
What's wrong in my logic?