I developed a project but now I wants to apply JavaScript to project. Take an example of Login Form. In that I have to assign HTML id to text-fields but HOW? and how I can access the text-fields in js file?
<% @page_title = 'Staff Area Login' -%>
<%= form_for(:stuff, :url => {:action => 'send_login'}) do -%>
<p>Username: <%= text_field_tag('username', params[:username]) %></p>
<p>Password: <%= password_field_tag('password') %></p>
<%= submit_tag("Log in") %>
<% end -%>
You can use the :html hash.
<%= text_field_tag('username', params[:username], :html => {:id => "username_field"}) %>