How to pass aria-describedby to a form input?

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") %>

You might try…

"aria-describedby": "locationHelpBlock"
1 Like

or aria_describedby: "locationHelpBlock"

2 Likes

Lol both of these solutions work so I don’t know how to flag that.