Vitalyp
Vitalyp

Reputation: 1089

How to create inputs through text_field_tag helper, without id

I have auto-generated text_field_tag inputs, and I don't want id attributes there. How to do this correctly?

Upvotes: 5

Views: 858

Answers (1)

Jakub K
Jakub K

Reputation: 1711

You can specify the id of the generated text field or any other HTML attribute in the options attribute of text_field_tag. Setting it to nil should remove it completely:

text_field_tag('name', nil, id: nil)

Upvotes: 5

Related Questions