Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adding a class to a text_field_tag

I am trying to give a class to my text_field_tag

I have this

<%= text_field_tag :login_aei, class: 'form-control' %> 

but it keeps generating this :

<input type="text" name="login_aei" id="login_aei" value="{:class=>&quot;form-control&quot;}"> 

What am I doing wrong ?

like image 318
David Geismar Avatar asked Aug 31 '15 19:08

David Geismar


1 Answers

You declared it wrong. Here is the one will work.

<%= text_field_tag :login_aei, "", class: 'form-control' %> 

I gave the value of the input field as empty string, but you can give any value what meets your business needs.

like image 137
Arup Rakshit Avatar answered Sep 26 '22 01:09

Arup Rakshit