Hi, I’m trying to pass an aria-describedby
attribute to my multiselect, but I can’t figure out the right way to pass it to the options. This is my current code:
<%= multiple_select(f, :locations, locations_list(@locations),
selected: Enum.map(@user.locations, &(&1.id)),
[class: "form-control", "aria-describedby" => "locationHelpBlock"]) %>
<small id="locationHelpBlock" class="form-text text-muted">
Hold Ctrl or Cmd while clicking to select multiple locations.
</small>
Solution
To clarify, both solutions below work, and here’s the full code for both solutions:
<%= multiple_select(f, :locations, locations_list(@locations),
selected: Enum.map(@user.locations, &(&1.id)),
class: "form-control", "aria-describedby": "locationHelpBlock") %>
<%= multiple_select(f, :locations, locations_list(@locations),
selected: Enum.map(@user.locations, &(&1.id)),
class: "form-control", aria_describedby: "locationHelpBlock") %>