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
$(function(){ $("#first_name, #second_name").bind("change keyup", function(){ if($("#first_name").val() != "" && $("#second_name").val() != "") $(this).closest("form").find(":submit").removeAttr("disabled"); else $(this).closest("form").find(":submit").attr("disabled","disabled"); }); });