首页 > 解决方案 > 我需要进行按钮加载...在点击和加载之前的同时...检查所需的验证

问题描述

我正在编写一段 HTML 和 JavaScript 代码,我需要在单击加载按钮之前检查输入是否已填充。但是,当我将它们留空时,它会继续将变量传递为空的 PHP 页面。

我需要的是在加载按钮和禁用之前将表单验证添加到此代码中。

$(document).ready(function() {
  $("#btnFetch").click(function() {
    // disable button
    $(this).prop("disabled", true);
    // add spinner to button
    $(this).html(
      '<i class="fa fa-circle-o-notch fa-spin"></i> loading...'
    );
  });
});

标签: javascripthtmljquery

解决方案


推荐阅读