I made button for selecting timeslot.
And I would like to make when second-click, have a time slot on first click and second click and transfer this data.
for example ) first click on time slot "12:00 -13:00" and second click on time slot "13:00-14:00"
then firsttimeslot = "12:00 -13:00", secondtimeslot="13:00-14:00"
I try to use count on button, but it doesnot work!
<button class ="btn btn-success book" data-timeslot="12:00 - 13:00 " count ="1"> 12:00 -13:00</button>
$(".book").click(function(){
var count = $(this).attr('count')
if(count =="1")
{
var firsttimeslot = $(this).attr('data-timeslot');
$(".book").attr('count') = "2";
}
else{
var secondtimeslot=$(this).attr('data-timeslot');
$("#timeslot").val(firsttimeslot.trim());
$("#secondtimeslot").val(secondtimeslot.trim());
}
}
)
</script>