Я хочу показать аналогичный тип ошибки, как показывает мой min /max javascript, если старт утреннего /дневника больше, чем утреннее /днем. PrettyPrint-Override ">
Код: Выделить всё
var timesOfDay = ["morning", "afternoon"];
const startTime = ["08:00:00", "13:00:00", "16:30:00", "17:30:00", "21:00:00"];
const endTime = ["13:00:00", "16:30:00", "17:30:00", "21:00:00", "08:00:00"];
i = 0;
timesOfDay.forEach(item =>
{
//the error messages show correctly using the next 4 lines of code
document.getElementById(item+"TimeStartArea").min = startTime[i];
document.getElementById(item+"TimeStartArea").max = endTime[i];
document.getElementById(item+"TimeEndArea").min = startTime[i];
document.getElementById(item+"TimeEndArea").max = endTime[i];
//I want to achieve something similar if morning/afternoon start time > morning/afternoon end time and vice versa
if (document.getElementById(item+"TimeStartArea").value > document.getElementById(item+"TimeEndArea").value)
{
//show a similar error message on the correct input fields.
}
i++;
});
i = 0;< /code>
Morning start:
Morning end:
afternoon start:
Afternoon end:
Подробнее здесь: https://stackoverflow.com/questions/797 ... -input-end
Мобильная версия