In my rails application, I have a single datepicker from bootstrap in the index of my events page.
<input type="text" name="datefilter" value="" />
<script type="text/javascript">
$(function() {
$('input[name="datefilter"]').daterangepicker({
singleDatePicker: true,
locale: {
cancelLabel: 'Clear'
}
});
$('input[name="datefilter"]').on('cancel.daterangepicker', function(ev, picker) {
$(this).val('');
});
});
</script>
Once I select a date in the datepicker, I want to be able to list out all the events created that day based on the created_at attribute.
I'm assuming I will be using a function similar to
@events = Event.all.where(date_selected)
and then just looping through them
<%@events.each do |e|%>
<% e.name %>
.
.
.
etc
<%end %>
but i am unsure how to define "date_selected" in bootstrap to be able to access all the events for that day based on their created_at attribute.
**In response to duplicate question: I am trying to understand how to select a date for an event in my function, not change an event in jquery. I would then like to list out all events created on the selected date.