Adding a class to a generated input field

Whne creating a field using for example:

<%= text_field_tag :name, params[:name] %>

You get:

I would like to add a class to that input so that it looks like this:

How do I add a class to a generated input?

(I want it as a CSS hook, and do not want to use the ID for that.
Alternative is wrapping each input in a span with a class but thats a
waste.)

On 17 Nov., 09:20, Steve O. [email protected] wrote:

How do I add a class to a generated input?

That should do it:

text_field_tag :name, params[:name], :class => “field”

Stefan