I am learning Rails 3 and need some help on Ajax part.
I am trying to accomplish the following:
There is a textarea on the page which has a length of letters
constraint, say 100. Every time a symbol is typed there,a nearby label
tells you how many letters you have left.
I plan to use Ajax to do this.
I googled for a few hours and could not figure out how to do this.
So far what I have done is the follows:
Step 1. Add :remote => true to the form_for method. This form_for method
lives in a partial which is called in app/views/foos/home.html.erb
Step 2. Add
respond_to do |format|
to FoosController's corresponding Home action.
Step 3.create home.js.erb under app/views/foos/
But I do not know how to add something so when a letter is typed in a
textarea inside the form generated by form_for method that home.js.erb
Could someone help me out here?