Guest User

Untitled

a guest
May 22nd, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. $(function() {
  2. $('#post_message').keyup(function() {
  3. var content_length = $(this).val().length;
  4. var remaining = 420 - content_length
  5. $('.counter').html(remaining);
  6. if (remaining < 0) {
  7. $('input[type=submit]').attr("disabled", "disabled");
  8. } else if (remaining < 21 && remaining > 9) {
  9. $('input[type=submit]').removeAttr("disabled");
  10. $('.counter').removeClass('red');
  11. $('.counter').addClass('dark_red');
  12. } else if (remaining <= 9) {
  13. $('input[type=submit]').removeAttr("disabled");
  14. $('.counter').removeClass('dark_red');
  15. $('.counter').addClass('red');
  16. } else {
  17. $('input[type=submit]').removeAttr("disabled");
  18. $('.counter').removeClass('dark_red').removeClass('red');
  19. }
  20. })
Add Comment
Please, Sign In to add comment