You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added this code on Elementor custom code but it's working on the page but not on the popup, can anyone guide me on how to place it and correct the code?
<script>
jQuery(document).ready(function ($) {
setTimeout(function () {
$('.elementor-time-field.flatpickr-input').each(function () {
flatpickr($(this)[0], {
enableTime: true,
noCalendar: true,
dateFormat: 'H:i',
minTime: '10:30',
maxTime: '16:30',
time_24hr: true,
onClose: function (selectedDates, dateStr, instance) {
if (!isTimeValid(dateStr)) {
alert('Please select a valid time between 10:30 am and 4:30 pm.');
instance.clear(); // Clear the invalid input
}
}
});
});
}, 1000);
function isTimeValid(selectedTime) {
var parsedTime = selectedTime.split(':');
var hours = parseInt(parsedTime[0], 10);
var minutes = parseInt(parsedTime[1], 10);
return (hours > 10 || (hours === 10 && minutes >= 30)) &&
(hours < 16 || (hours === 16 && minutes <= 30));
}
});
</script>
Thanks
The text was updated successfully, but these errors were encountered:
I added this code on Elementor custom code but it's working on the page but not on the popup, can anyone guide me on how to place it and correct the code?
<script> jQuery(document).ready(function ($) { setTimeout(function () { $('.elementor-time-field.flatpickr-input').each(function () { flatpickr($(this)[0], { enableTime: true, noCalendar: true, dateFormat: 'H:i', minTime: '10:30', maxTime: '16:30', time_24hr: true, onClose: function (selectedDates, dateStr, instance) { if (!isTimeValid(dateStr)) { alert('Please select a valid time between 10:30 am and 4:30 pm.'); instance.clear(); // Clear the invalid input } } }); }); }, 1000); function isTimeValid(selectedTime) { var parsedTime = selectedTime.split(':'); var hours = parseInt(parsedTime[0], 10); var minutes = parseInt(parsedTime[1], 10); return (hours > 10 || (hours === 10 && minutes >= 30)) && (hours < 16 || (hours === 16 && minutes <= 30)); } }); </script>Thanks
The text was updated successfully, but these errors were encountered: