I have a form with two input fields and a submit button on my page, I would like to have the feature that the \'submit\' button is disabled until there are
Here's a solution using jQuery:
HTML (note that I added a id to the submit button):
JavaScript/jQuery:
$(':text').keyup(function() {
if($('#first_name').val() != "" && $('#second_name').val() != "") {
$('#submit').removeAttr('disabled');
} else {
$('#submit').attr('disabled', true);
}
});
Working example: http://jsfiddle.net/nc6NW/1/