In designing a chat app i have text area and button in a form. To disable send button for empty textarea i did below code:
$(document).ready(function(){
$('#btn1').prop('disabled',true);
$('#msg').keyup(function(){
$('#btn1').prop('disabled', this.value == "" ? true : false);
})
});
Above code is disabling send button for initial blank space as well which i want to restrict (remember in textarea " hai" is fine but "(all blank spaces)" is not fine)
$('#btn1').prop('disabled', !this.value.trim())