2012-06-25 48 views
4

所以我的button_to erb標籤給了我類似的東西在下面,我想知道是否有可能通過在選項散列中傳遞某些東西而不是使用js或手工添加HTML:添加class id到button的div到

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

我的按鈕ERB代碼只是

<%= button_to title, {}, :id => "button"%> 

回答

0

你真的不能更改父div的ID,據我所知。

的button_to股權並不能真正允許該as you can see.

您可以雖然類添加到父窗體。不完全確定爲什麼用button_to命令添加div與按鈕是誠實的。

8

作爲3.2,button_to接受形式的散列經由html_options鍵 「形式」

<%= button_to title, {}, :form => { :id => "button" } %> 
屬性