I have a Rails 4, that uses Rails' default form (I am NOT using Simple Form).
In one of my forms, I would like to style the following submit button:
<td>
<%= f.submit %>
</td>
I tried to apply an id to the td but this obviously applied my new style to the entire table cell.
Then, I tried to apply an id to the submit button itself, as recommended here, as follows:
<td>
<%= f.submit, :id => 'create_post' %>
</td>
This gave me the following error:
SyntaxError in CalendarsController#show
/Users/TXC/code/rails/calendy/app/views/calendars/show.html.erb:69: syntax error, unexpected =>, expecting :: or '[' or '.' ...er.append=( f.submit, :class => 'create_post' );@output_buff... ... ^
<%= f.submit, :class => 'create_post' %>
What is a good way to apply a custom style to a submit button in Rails?
Try changing your syntax to this:
<%= f.submit, id: 'create_post' %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With