惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
SecWiki News
SecWiki News
Forbes - Security
Forbes - Security
N
News | PayPal Newsroom
S
Security @ Cisco Blogs
Schneier on Security
Schneier on Security
V
V2EX - 技术
S
Secure Thoughts
W
WeLiveSecurity
Google DeepMind News
Google DeepMind News
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
S
Securelist
S
Security Archives - TechRepublic
Know Your Adversary
Know Your Adversary
V
Vulnerabilities – Threatpost
Security Latest
Security Latest
Recent Commits to openclaw:main
Recent Commits to openclaw:main
G
GRAHAM CLULEY
H
Hacker News: Front Page
Microsoft Azure Blog
Microsoft Azure Blog
I
Intezer
Google Online Security Blog
Google Online Security Blog
美团技术团队
阮一峰的网络日志
阮一峰的网络日志
T
The Exploit Database - CXSecurity.com
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Webroot Blog
Webroot Blog
Jina AI
Jina AI
Engineering at Meta
Engineering at Meta
P
Proofpoint News Feed
The Cloudflare Blog
I
InfoQ
L
LangChain Blog
U
Unit 42
P
Proofpoint News Feed
S
Schneier on Security
S
Security Affairs
Y
Y Combinator Blog
T
Tenable Blog
N
News and Events Feed by Topic
MyScale Blog
MyScale Blog
量子位
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
博客园 - 聂微东
D
Darknet – Hacking Tools, Hacker News & Cyber Security
GbyAI
GbyAI
AWS News Blog
AWS News Blog

Html - 分类 - cywhat's blog

Jenkins端口修改之后没有生效 Jenkins添加html报告并发送到邮箱
html简单实现button加载中且置灰不可点击
cywhat · 2021-09-09 · via Html - 分类 - cywhat's blog

简单js几行代码实现点击按钮,实现加载中,且置灰不可点击

1.html部分

1
2
3
4

<button id="Submit" type="button"
        class="btn btn-rounded btn-primary mb-6" value="获取验证码">
</button>

2.JS部分

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
function ClickBtnSms() {
    $('#Submit').click(function () {
        //按钮校验,disable = true不可点击 val里面的内容替换成你想实现的加载中/loading...等
        $('#Submit').val('加载中...').prop('disabled', true);
        $.ajax({
            url: "url", 
            type: "GET",
            data: {data: data},
            dataType: "JSON", // 将服务端返回的数据反序列化为字典
            success: function (res) {
                if (res.status) {
                    //这里放拿到res状态想要执行的函数
                } else {
                    //如果报错,需要恢复获取验证码的按钮
                    $('#Submit').val('获取验证码').prop('disabled', false);
                }
            }
        })
    })
}

关注一下再走吧

公众号 小程序

赞赏支持

微信打赏 支付宝打赏