Stuck on step 6 onwards


#1

Hello friends! This is my code:

$(document).ready(() => {
  
  $('.menu').on('mouseenter', () => {
    $('.nav-menu').show();
  });  
  
  $('.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 => {
    const $post = $(event.currentTarget).val();
    const $remaining = (140 - $post.length);
    $('.characters').html(remaining);
  });
  
  $('.postText').focus();
});

I’ve beeen trying to make the characters counter work for more than a couple hours, but to no avail. May i have a hint please?
Thanks in advance.


#2

Anyone willing to help please? still stuck there


#3

We have your code, but nowhere to test it. Please post a link to the exercise. Thanks.


#4

https://www.codecademy.com/courses/learn-jquery-event-handlers/projects/feedster?course_redirect=learn-jquery

Sorry and thanks for your interest


#5

SInce $remaining is not a jQuery object, we don’t need to add the $. Remove it from the assignment line and the above will work.

Technically, $post is also not a jQuery object (but a string) so it should not have the $, either.


#6

Thanks, I managed to make it work after some more research and with your insight. Cheers :slight_smile:


#7

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.