Feedster jQuery Project

So, having some trouble with the following project:
https://www.codecademy.com/courses/learn-jquery/projects/feedster

The first part of my jQuery code is working fine, it’s everything to do with the text box and the character count line that I am struggling with here.

Tried using an outside editor to see if the different visual look would help me out, but all it’s returning for me in debugging is that $ready() and $focus() are depreciated.

$(document).ready(() => {
    $('.menu').on('mouseenter', () => {
      $('.nav-menu').show();
    });
    $('.nav-menu').on('mouseleave', () => {
      $('.nav-menu').hide();
    });
    $('.btn').on('mouseenter', event => {
      $(event.currentTarget).addClass('btn-hover');
    });
    $('.btn').on('mouseleave', event => {
      $(event.currentTarget).removeClass('btn-hover');
    });
    $('.postText').on('keyup', event => {
      let post = $(event.currentTarget).val();
      let remaining = 140 - post;
      if(remaining <=0){
        $('.wordcount').addClass('.red');
      } else {
        $('.wordcount').removeClass('.red');
      }
      $('.characters').html(remaining);
    });
    $('.postText').focus();
  });
  

I can’t seem to sort out what I’ve messed up to do with the textbox, but I don’t believe it’s focusing correctly, and the character count just deletes the number as soon as I start typing, does not count the characters, therefore the red portion doesn’t work.

I assume I’ve made an error in the creation of the variables? But I’ve refactored as many things as I can figure out and can’t get the site to function properly in the codecademy test environment, or in my own.

Thanks in advance

$(event.currentTarget).val() is returning the text that the textarea is currently holding.

So if “testing testing” was typed into the box, then this will assign the value of “testing testing” to the variable post.

Click for another hint

You’ll need to make adjustments to be able to calculate remaining

AHA!

let remaining = 140 - post.length;

did you make it work? my code still doesn’t update the remaining characters

hey there, sorry for the slow response, but yes I did, post your code, I’ll see if I can offer you a hint!

thanks for your response. I already solved it by not chaining the ‘.btn’ part.