Created
October 31, 2011 02:27
-
-
Save jaysonrowe/1326776 to your computer and use it in GitHub Desktop.
jQuery code for Textbox countdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script type="text/javascript"> | |
| <!-- | |
| $('#micropost_content').live('keyup keydown', function(e) { | |
| var maxLen = 140; | |
| var left = maxLen - $(this).val().length; | |
| $('#char-count').html(left); | |
| }); | |
| //--> | |
| </script> | |
| <%= form_for @micropost do |f| %> | |
| <%= render 'shared/error_messages', :object => f.object %> | |
| <div class="field"> | |
| <%= f.text_area :content, :maxlength => 140 %> | |
| </div> | |
| <div>Characters left: <span id="char-count">140</span></div> | |
| <div class="actions"> | |
| <%= f.submit "Submit" %> | |
| </div> | |
| <% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment