Show button if input is not empty

javascript, jquery

Solution

if(!$('input').val()){
    $('#button').hide();
}
else {
    $('#button').show();
}

In it's simplest form ;)

Problem

I am not much of a JavaScript guru, so I would need help with a simple code. I have a button that clears the value of an input field. I would like it (the button) to be hidden if input field is empty and vice versa (visible if there is text inside the input field). The solution can be pure JavaScript or jQuery, it doesn't matter. The simpler, the better.

Original source