Tuesday, April 5, 2011

rails button_to is not setting the class correctly

My code:

<%= button_to 'Login', {:type => 'submit', :class => 'submit'} , {}%>

I want to end up with this:

<input type='submit' value='submit' class=submit/>

but what I'm getting is:

<input type=submit value=submit/>

how to set the class?

From stackoverflow
  • The HTML options are the third parameter according to the documentation. Try this:

    <%= button_to 'Login', {}, { :type => 'submit', :class => 'submit' } %>
    

0 comments:

Post a Comment