I am using simple form in my application, i have an inline js to set field name and unset when user clicks on the field and modify it as shown below
input type="text" class="ftext" value="First Name" onclick="if(this.value=='First Name') this.value='';" onblur="if(this.value=='') this.value='First Name'"
I am trying to do this with simple form inpt <%= f.input :password, :required => true, :class => "ftext" %>
, but cannot able to find any solution in web.
Please suggest me on this.
thanks, Balan
We can do this by using "input_html" option as shown below :
<%= f.input :email, :required => true, :autofocus => true, :input_html => { :onclick => "customFunction()", :class => "stext", :style => "padding-left:93px;width:170px;" } %>