//禁用button
$('button').addClass('disabled'); // Disables visually
$('button').prop('disabled', true); // Disables visually + functionally
//禁用类型为button的input按钮
$('input[type=button]').addClass('disabled'); // Disables visually
$('input[type=button]').prop('disabled', true); // Disables visually + functionally
//禁用超链接
$('a').addClass('disabled'); // Disables visually
$('a').prop('disabled', true); // Does nothing
$('a').attr('disabled', 'disabled'); // Disables visually
将上面方法写入点击事件中即可,如:
$(".btn-check").click(function () {
$('button').addClass('disabled'); // Disables visually
$('button').prop('disabled', true); // Disables visually + functionally
});
js按钮点击后几秒内不可用:
function timer(time) {
var btn = $("#sendButton");
btn.attr("disabled", true); //按钮禁止点击
btn.val(time <= 0 ? "发送动态密码" : ("" + (time) + "秒后可发送"));
var hander = setInterval(function() {
if (time <= 0) {
clearInterval(hander); //清除倒计时
btn.val("发送动态密码");
btn.attr("disabled", false);
return false;
}else {
btn.val("" + (time--) + "秒后可发送");
}
}, 1000);
}
//调用方法
timer(30);

BootStrap中按钮点击后被禁用按钮的最佳实现方法的更多相关文章

  1. Bootstrap中宽度大于指定宽度时有空白的解决方法

    <div class="container-fluid"></div> 其中container-fluid的作用是占100%

  2. 如何在winform DataGridView控件的DataGridViewButtonColumn按钮列中禁用按钮

    原文:http://msdn.microsoft.com/en-us/library/ms171619(v=vs.85).ASPX public class DataGridViewDisableBu ...

  3. bootstrap注意事项(六)按钮

    1.预定义样式 使用下面列出的类可以快速创建一个带有预定义样式的按钮 <!DOCTYPE HTML><html><head> <link rel=" ...

  4. Bootstrap知识记录:表格和按钮

    基本格式.table3.带边框的表格//给表格增加边框<table class="table table-bordered">4.悬停鼠标//让<tbody> ...

  5. bootstrap 学习笔记(4)---- 按钮

    平常我们自己写按钮,这次不用我们自己写 了,直接应用bootstrap中的按钮样式,就能设计出很漂亮的按钮样式.接下来就让我们一起学习吧. 1.可以作为按钮使用的标签或元素:<a>< ...

  6. bootstrap基础学习【菜单、按钮、导航】(四)

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  7. Dynamics 365 CE命令栏按钮点击后刷新表单页面方法

    微软动态CRM专家罗勇 ,回复326或者20190428可方便获取本文,同时可以在第一间得到我发布的最新博文信息,follow me! Dynamics 365 Customer Engagement ...

  8. js中confirm揭示三个按钮“是”“否”“取消”

    js中confirm提示三个按钮“是”“否”“取消” 重载DOM中confirm window.confirm = function(str) {   str=str.replace(/\'/g, & ...

  9. JQuery脚本-通过禁用按钮防止表单重复提交

    <script type="text/javascript"> /* jquer 脚本,避免重复提交 隐藏点击的submit,后在他之后插入同名button伪装成被隐藏 ...

随机推荐

  1. Spring Hello World

    1. 概述 Spring 框架是一个开源的 Java 平台,它最初是由 Rod Johnson 编写的,并且于 2003 年 6 月首次在 Apache 2.0 许可下发布. 1.1 依赖注入 1.2 ...

  2. Spring Cloud 概述

    1. Spring Cloud 引言 首先我们打开spring 的官网:https://spring.io/ 我们会看到这样一张图片 这个图片告诉我们,开发我们的应用程序就像盖楼一样, 首先我们需要搭 ...

  3. schema中的虚拟属性方法

    schema中的虚拟属性方法相当于vue中的计算属性,它是通过已定义的schema属性的计算\组合\拼接得到的新的值 var personSchema = new Schema({ name: { f ...

  4. bazel-编译静态库

    demo3 使用bazel编译静态库 demo3目录树 ├── README.md ├── static │ ├── BUILD │ ├── static.c │ └── static.h └── W ...

  5. Oracle PLSQL Demo - 24.分隔字符串function

    -- refer: -- http://www.cnblogs.com/gnielee/archive/2009/09/09/1563154.html -- http://www.cnblogs.co ...

  6. CentOS7.3 搭建Openvpn

    环境:CentOS Linux release 7.3.1611 (Core) 查看os版本命令:[root@openvpn ~]# cat /etc/redhat-release 命令记录如下: y ...

  7. 第一章: 当前主流的小型嵌入式 GUI

    以下内容转载自安富莱电子论坛:http://forum.armfly.com/forum.php?mod=viewthread&tid=24507&highlight=%B5%B1%C ...

  8. DataTable某一列的最大值

    .datatable.compute("max(列名)","") eg:  int max_Idx_Number = 1;     int.TryParse(C ...

  9. Hadoop的体系结构之HDFS的体系结构

    Hadoop的体系结构 Hadoop不仅是一个用于分布式存储的分布式文件系统,而是设计用来在由通用计算设备组成的大型集群上执行分布式应用的框架. HDFS和MapReduce是Hadoop中的两个最基 ...

  10. Eclipse 中 Debug 模式跳转到 exitCurrentThread 的问题解决

    问题描述: Debug 模式启动项目,断点跳转到exitCurrentThread 解决方法: 修改Eclipse 配置 [window]->[Preferences]->[Java]-& ...