Disable button 2


#1

I had requested to write full code so that I can check where is the error in my
code.Pl help.
Thanks
Rajesh


#2

it's much more useful and productive to tell what you have a problem with/what the error is and people can help and explain, than ask for a full code. don't really get much learning out of it in that way.

but whatever, here's the full code:

var main = function() {
  $('.btn').click(function() {
    var post = $('.status-box').val();
    $('<li>').text(post).prependTo('.posts');
    $('.status-box').val('');
    $(".counter").text("140");
    $(".btn").addClass("disabled");
  });
  
$('.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');
  }
});

$('.btn').addClass('disabled');
  
};

$(document).ready(main);

#3

Hi hey cat
Still with this code exercise is not passing and it says press 'Save & Submit' and only writing a message it will pass through.What does it mean.I have spent maximum time on this exercise then on any other course.
Rajesh


#4

Strange. Mine works normally.

All you have to do is go into the "Full Screen", then write a some text into the box and press "Post". And it should display your message like this:

After that you can go back to the editor, press Save and submit the code, and it should work.


#6

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