message.keypress(function(e) {
  var fieldValue  = $('textarea').val(),
      lengthValue = fieldValue.length,
      set         = 400,
      remain      = parseInt( set - lengthValue );

      $( '#counter > span' ).text( remain );

      if ( remain <= 0 && e.which !== 0 && e.charCode !== 0 )
        $('textarea').val( ( fieldValue ).substring( 0, lengthValue  - 1 ) );
});