I decided to go with jQuery and found the implementation to be quite simple. First you need to install jQuery in Rails, and you can find instructions on how to do this here.
Once jQuery was installed, I simply had to add the jQuery code to my form, as well as modify the original form code to limit the characters to 140 with f.text_area :content, :maxlength => 140 :
Just for reference, the original code for the form (without the textbox countdown) was as follows:
Feel free to use or modify this code if you found it helpful to you!
Wow, thanks for the excellent post! I needed this functionality and with your post I was able to get it working within 5 minutes! Thank you so much and keep up the great sharing! Cheers!
ReplyDelete