I have a rails form that has this code:
<%= form_tag("../vehicles", method: "get") do %>
<div>
<div>
<%= label_tag(:address, t("ui.reservations.pickup"), data-addr: 'here') %>
</div>
<div>
<%= label_tag(:address, t("ui.reservations.between_now_and_param", param: @start_date.strftime( time_format))) %>
</div>
<div>
I want to add a HTML data attribute to the first label, so I tried:
<%= label_tag(:address, t("ui.reservations.pickup"), data-addr: 'here') %>
but I get a syntax error:
SyntaxError in Reservations#new
.../_form.html.erb:8: syntax error, unexpected tLABEL
');@output_buffer.append= ( label_tag(:address, t("ui.reservations.pickup"), data-addr: 'here') );@output_buffer.safe_concat('...
I can add it as
<%= label_tag(:address, t("ui.reservations.pickup"), data: 'here') %>
That generates:
<label for="address" data="here">
but I don't seem to be able to add data-something
attributes. I get a syntax error.
How can I do this?