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