I currently have this setup.
For the HTML:
<%= select_tag "Groups", options_from_collection_for_select(@groups, "id", "name", params[:filter]),
class: "filter-groups",
prompt: "All Groups"
%>
For the jquery:
$(document).on('ready page:load', function() {
$('.filter-groups').on('change', function() {
window.location.replace('/people?filter='+this.value);
});
});
So, right now I'm using a class to find the element. But I want to change to use a data attribute instead. Can anyone help me with this? FYI, I don't need the class at all so I'd like to remove that completely for the data attribute.