Fill with message with focus on empty

$('#button').click(function()
{
if ($('#the input').val().trim().length === 0)
{
    $('#input to fill').focus();
    $('#message').text('the input is empty').show();
    return false;
}
else if ($('#the another input').val().trim().length === 0)
{
    $('#input to fill').focus();
    $('#message').text('the input is empty').show();
    return false;
}
}

Is with a button click and when try to focus on not filled input then skip to next else if rule and display second text and do nothing about focus any idea why?

Thanks

Ids can’t contain spaces, for starters.

is for example code I know that… i just use text

Do you have these in an onBlur event listener or something?

I use with this $(’#button’).click(function(){}