Jquery: Feedster Project

Hello everyone,
I am looking for help with debugging what I am doing wrong with this project. Can’t find a solution anywhere and was hoping a fresh set of eyes could help me learn my mistake. Please and thank you!

Project Link: Jquery: Feedster Project

My code is below:

$(document).ready(() => {
	$('.menu').on('mouseenter', () => {
    $('.nav-menu').show();
  });

  $('.nav-menu').on('mouseleave', () => {
    $('.nav-menu').hide();
  });

  $('.btn').on('mouseenter', (event) => {
    $(event.currentTarget).addClass('btn-hover')
  }).on('mouseleave', (event) => {
    $(event.currentTarget).removeClass('btn-hover');
    });

  $('.postText').on('keyup', (event) => {
    let post = $(event.currentTarget).val();
    let remaining = 140 - post.length();
    if(remaining <= 0) {
      $('.wordcount').addClass('red');
    } else(remaining > 0) {
      $('.wordcount').removeClass('red');
    }
    $('.characters').html(remaining);
  });

  $('.postText').focus();
}); 

Also, here is a JSFiddle setup.

I think
post.length();
should be
post.length;
instead.

else should not have a condition after it.
That should be

    } else {
      $('.wordcount').removeClass('red');
    }
1 Like

You’re right, thank you! JSLint picked up the else condition error but the length one didn’t. Appreciate your time :call_me_hand: