1
I have a chat system, and the send button should not be enabled until the user type some letter.
In the example below the button is enabled when the user type something, but if he only type spaces the button is displayed.
$('#msg').on('keyup',function() {
var textarea_value = $("#msg").val();
if(textarea_value != '') {
$('.button-enviar').attr('disabled' , false);
$('.button-enviar').removeClass('disabled');
}else{
$('.button-enviar').attr('disabled' , true);
$('.button-enviar').addClass('disabled');
}
});
How to check if the variable textarea_value contains only spaces? So do not enable the button.