Reputation: 880
On an index page for all my short posts, I have a form partial so a user can easily add a new short post. I use Ajax so that when I submit the new post, it appends it to the list of all posts without reloading the page and the form is also rendered again with Ajax.
Within that form, I have a textarea, and I use a jQuery plugin that inserts into a span element next to the textarea how many characters they've got left (much like Twitter).
On page load, I see the counter and it works, but when I submit the form and the form is re-rendered, the counter isn't displayed.
Upvotes: 0
Views: 35
Reputation: 953
If the jQuery plugin that inserts the span element for the counter is running on initial page load, it won't run again when the form is re-rendered unless you call it again. Without seeing any code snippets, I think the answer is that you will have to reinitialize the counter plugin to show a new span element after the form is rendered the second time.
Upvotes: 2