I want to use observe_field
to give me the character count of the textarea, updated as you type. What am I doing wrong here?
<div class="field">
<%= observe_field :micropost_content,
:function => "$(开发者_如何学C'micropost_content').value.length" %>
<%= f.text_area :content %>
</div>
If you don't set the frequency option it becomes event based (onchange.) Try:
<%= observe_field :micropost_content, :frequency => 1,
:function => "$('micropost_content').value.length" %>
精彩评论