How to block a button?

If the data from the form is not entered, then the submit button does not work.


Answer 1, authority 100%

Here’s a jQuery solution

$(function() {
  $(":text").keypress(check_submit).each(function() {
    check_submit();
  });
});
function check_submit() {
  if ($(this).val().length == 0) {
    $(":submit").attr("disabled", true);
  } else {
    $(":submit").removeAttr("disabled");
  }
}