Dear all, I'm new to Rails and Web development, I have a problem about how to "bind a JS event to a field within form_for block".
I have a JS function called checkLength, which is used to check the length of words typed in a text area field: HTML code with JS event invocation ======================================== <textarea id="micropost" name="micropost" rows="4" cols="60" onpropertychange="checkLength(this,5);" oninput="checkLength(this, 5);"> Now I would like to reuse this JS funtion in another Rails view page, which the src code is listed below: _micropost_form.html.erb ========================================= <%= form_for @micropost do |f| %> .... f.text_area :content .... <% end %> The question is after I put the JS function under RAILS_APP/public/ javascript as custom.js and include it with javascript_include_tag. HOW CAN I ADD AN EVENT AT THE TEXT_AREA FIELD WITHIN THE CODE : f_text_area :content AND CALL THE JS FUNCTION LIKE : oninput="checkLength(this, 5)" -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

