Yes, it has if/else statement, you may try this
$('button').click(function(){
var message = $('textarea').val();
var old = $('#content').html();
if(message.length==0) return false;
$('#content').html(old + '<p>' + message);
});
1
solved If textfield is empty do not send! – Help JavaScript [closed]