Could anyone help me with this? I am desperately need help! Thanks!


#1

Here is my code, could anyone please help me?

var main = function () {
$('.btn').click(function(){
var.post= $('.status-box').val();
$('

  • ').text(post).prependTo('.posts');
    $('.status-box').val('');
    $('.counter').text('140');
    });

    $('.status-box').keyup(function() {
    var postLength = $(this).val().length;
    var charactersLeft = 140 - postLength;
    $('.counter').text(charactersLeft);

    if(charactersLeft < 0) {
    $('.btn').addClass('disabled');
    }
    else if(charactersLeft = 140) {
    $('.btn').addClass('disabled');
    }
    else {
    $('.btn').removeClass('disabled');
    }
    });
    };
    $(document).ready(main);


  • #2

    @gracetong0630,

    You are using an_assignment_ operator in your ELSE-IF-condition

    else if(charactersLeft = 140) {

    change this into a comparison-operator

    else if(charactersLeft === 140) {

    #3

    Hi all,

    I figured out!

    [Code removed by moderator- please refrain from posting the correct code, as doing so allows others to cheat the lessons with less effort]