var form = $('#myForm'), login = $('#login'), pass = $('#pass'), submit = $('#button'); form.change(function(){ if(login[0].value != '' && pass[0].value != ''){ button.disabled = false; }else{ button.disabled = true; } })