1
I have two input
with jQuery which loads a time interval of 30 minutes every 30 minutes.
The first is the check-in time, the second is the check-out time.
$(function() {
$('.timepicker').timepicker({
interval: 30,
minTime: '7',
maxTime: '18',
dynamic: false,
dropdown: true,
scrollbar: true
});
});
I wanted to know how to create a function inside the jQuery code ("minTime:") so that it is impossible to put exit time before the input time.
Site made in PHP.
thank you very much! that’s exactly what I needed.. Only there’s one detail that I found unnecessary to say, but it’s not.. i have input and output every day of the week.. do I have to copy that code 7 times? there is a way to associate the input and output of each day? (the input is all within a table)
– ThiagoKoller
@Thiagokoller selectors are ordinary jQuery so you just have to do it in a way that the script knows which input to link to. For example, if both are within the same line
tr
table, you can do something like$(this).parents('tr').find('.timepicker-saida').timepicker('option', 'minTime', // etc)
. This gives you more flexibility. If you need more details, open another question with this specific theme.– Ricardo Moraleida