This is the week date calendar
I have a week calendar. The problem is when i click on right arrow icon it selects the next radio button automatically, but when i click on left arrow it doesn't work and if I comment the right-arrow code the left arrow works. Can anyone give me the fiddle example for it. I giving the code which I wrote:
jQuery:
$('.left_arrow').on('click', function(e) {
var value = $('.time-slot input[type=radio]:checked').attr('data-attr');
console.log(e.target, value);
if (parseInt(value) > 0) {
$($('.time-slot input[type=radio]')[(parseInt(value) - 1)]).attr("checked", true)
}
});
$('.right_arrow').on('click', function(e) {
var value = $('.time-slot input[type=radio]:checked').attr('data-attr');
if (parseInt(value) < 6) {
$($('.time-slot input[type=radio]')[(parseInt(value) +
1)]).attr("checked", true)
}
});