Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding class id to div of button_to

So my button_to erb tag gives me something similar what is below and I was wondering if it was possible to add an id to the div by passing something along in the options hash rather than using js or adding html manually:

<div>
<input id="button" type="submit" value="title">
<input name="auth_token">
</div>

My button erb code is just

<%= button_to title, {}, :id => "button"%>
like image 903
blc Avatar asked Jun 25 '12 18:06

blc


1 Answers

As of 3.2, button_to accepts a hash of form attributes via the html_options key "form"

<%= button_to title, {}, :form => { :id => "button" } %>
like image 175
ahacop Avatar answered Sep 26 '22 01:09

ahacop