javascript - 我需要进行按钮加载...在点击和加载之前的同时...检查所需的验证
问题描述
我正在编写一段 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...'
);
});
});
解决方案
推荐阅读
- redis - redis如何在1个查询中组合多个命令
- php - PHP 包括:无法打开流:没有这样的......但是正在提供文件
- java - 如何将用户输入的数字范围设置为二维数组
- node.js - 有没有办法在快速中间件中避免多个 next()
- python - Python - 访问 JSON 元素
- python - 导入气流-> ImportError:无法导入名称版本(使用 Python 2.7)
- sql - 错误:缺少表“测试”的 FROM 子句条目
- python - PyAutoGui LocateOnScreen() 返回“无”
- android - Android Studio 无法从 lib 文件夹中的 .JAR 文件导入函数
- android - Android 在使用 NavController 时向上导航正确的图表