jquery 禁用 submit 按钮 防止重复

function disabledButton() {
$("input[@type='submit']").each(function () {
$(this).bind("click", function () {
$(this).attr("disabled", true);
$(this).parents().filter("form").trigger("submit");
});
});
}


var initFun = window.onload;
if (initFun == null) {
window.onload = disabledButton;
} else {
window.onload = function () {
initFun();
disabledButton();
};
}



生成js文件,页面加载就可以了.用submit 按钮生效
(表单重复提交)jquery验证 通过时,提交按钮变灰,不通过时正常显示 原理 ,所有表单验证通过后,form.submit();进行表单提交。 实例1 因此在在验证回来通过之后,表单提交前 设置提交按钮为灰 document.getElementById("signupbutton").disabled=true;             form.submit();   //自定义验证规则 $(document).rea 阅读详情

相关推荐

Clang Static Analyzer 使用教程:本地 + CMake + GitHub Actions 自动静态分析实战

本文介绍了ClangStaticAnalyzer静态代码分析工具的使用方法。该工具基于Clang/LLVM,可检测C/C++代码中的内存泄漏、空指针等常见错误。主要内容包括:安装指南(Ubuntu/macOS/Windows)、命令行使用方法、CMake项目集成方案、GitHub Actions自动化分析配置,以及HTML报告生成与查看。文章还提供了官方资源链接,帮助开发者系统掌握从本地调试到持续集成的完整静态分析工作流,提升代码质量保障能力。适用于需要在开发过程中实施静态分析的C/C++项目。

u014358031的博客 2156

jquery中使用submit提交按钮

1.jquery中使用submit提交按钮时,当return false后,依然会提交表单的 解决的办法是:使用button按钮,而不是submit按钮 看下面的例子   <title>用户修改密码</title> <script type="text/javascript" src="scripts/jquery-2.0.2.js"></scr...

iteye_12664的博客 862

莫兰指数stata命令_一文读懂16个sp系列stata空间计量命令及应用

spcompress:Compress Stata-format shapefile压缩数据成stata格式的shapefile2、Looking at data/观测数据2、Looking at data/观测数据grmap:Graph choropleth maps绘制等值区域图spdistance:Calculator for distance between places计算区域之间距离3...

weixin_39719989的博客 821

jQuery禁用/启用提交按钮

我有这个 HTML:我该怎么做这样的事情:当文本字段为空时,应禁用提交 (disabled="disabled")。在文本字段中键入内容以删除禁用属性时。如果文本字段再次变为空(文本被删除),则应再次禁用提交按钮。我试过这样的事情:……但它不起作用。有任何想法吗?

HuntsBot的博客 1435

CCD成像原理以及机器视觉中的相机选型

CCD成像原理以及机器视觉中的相机选型 近年来,随着人工智能的高速发展和图像处理技术的日益成熟,机器视觉在自动化领域发挥着越来越大的作用。机器视觉被用于代替人工视觉,使机器人能够完成以往只有人工才能完成的任务,这大大减少了在危险环境下工作的风险。同时,在来料无序或工作环境杂乱的情况下,机器视觉可以显著提高生产效率和自动化柔性程度。随着人们对工业设计水平和生产效率需求的日益提高,机器视觉正在逐步代替传统复杂繁琐的自动化模式,成为当今的主要发展趋势。 机器视觉是一项综合的技术,包括数字图像处理,传感器,光学

cszn6666的博客 5570

ARM Cortex平台NEON指令集优化实战指南

本文为ARM Cortex平台开发者提供了一份全面的NEON指令集优化实战指南。文章从NEON的SIMD架构原理讲起,详细介绍了开发环境搭建、NEON内联函数与自动向量化两种核心编程方法、关键数据类型与指令,并通过图像饱和运算、矩阵乘法等实战案例,深入解析了性能调优技巧与常见避坑指南,旨在帮助开发者充分释放ARM处理器的并行计算潜力。

weixin_29162439的博客 259

jquery原生如何特定的条件里面阻止form表单提交

【代码】jquery原生如何特定的条件里面阻止form表单提交。

熟悉 vue2 vue3 jquery js echarts 709

手把手教你学PCIE--所有 PF(Physical Function)共同管理和分配 VF

但具体如何分配和使用 VF 取决于硬件设计、驱动程序配置以及实际应用场景。

MHD0815的博客 1462

submit阻止默认行为

/ 如果不阻止默认行为, 点击提交按钮,将会跳转到baidu的页面。

pscool的博客 214

短信验证码逻辑漏洞学习——各种绕过姿势技巧

短信验证码逻辑漏洞学习——各种绕过姿势技巧

记录并分享学习安全的知识点.. 2555

Qt/C++音视频开发1-vlc解码播放

一、前言 最开始接触视频监控这块的时候,用的就是vlc作为解码的内核,主要是因为vlc使用简单方便,直接传入一个句柄即可,简单几行代码就可以实现一个视频流播放,很适合初学者使用,也推荐初学者用qt+vlc来做播放器,提供的接口还是非常友好的,而且门类特别多,想要获取媒体文件的各种信息比如宽高,设置宽高比等,直接调用接口函数传入参数就能设置。 所有用vlc做视频监控解码的人都会遇到一个问题,那就是鼠标事件被接管拦截了,不能识别鼠标事件,比如双击最大化等,这就很憋屈了,明明很好用的一个东西,怎么突然之间鼠标事件

Qt/C++视频监控/推流/物联网/大屏系统/自定义控件/UI定制/输入法 4938

LDRA Testbed软件静态分析_常见问题及处理

通过前面的几篇文章,LDRA Testbed软件静态分析的内容基本讲解完了,本篇文章将针对使用Testbed进行软件静态分析的常见问题进行介绍。 到此为止,LDRA Testbed软件静态分析的内容已经全部讲完,如果有问题,欢迎私信提问(不经常登录,回复可能不及时,见谅)。下一篇文章将开始讲解如何使用Testbed进行单元测试。

文章主要涉及嵌入式软件开发、测试、项目管理等,欢迎交流,共同进步。 2585

jQuery 禁用表单提交按钮,防止用户请求重复提交

当页面上有表单的时候,为了防止用户等不及服务器端响应重复点击提交按钮向服务器端发送重复请求,我们通常需要在请求提交之前将提交按钮禁用。 先来看一下页面。 当用户点击提交申请这个按钮时,我们需要将其禁用。 $("button.btn-submit", $form).attr("disabled","true"); 一般请求结束会遇到两种情况,一种是 success,一种是 error,如果要在这...

沉默王二 4750

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

jQuery 禁用表单提交按钮,防止用户请求重复提交!!!重点

当页面上有表单的时候,为了防止用户等不及服务器端响应重复点击提交按钮向服务器端发送重复请求,我们通常需要在请求提交之前将提交按钮禁用。 当用户点击提交申请按钮时,我们需要将其禁用。 $(“button.btn-submit”, $form).attr(“disabled”,“true”); 1 一般请求结束会遇到两种情况,一种是 success,一种是 error,如果要在这两个函数中去掉按钮的禁...

weixin_43893935的博客 340

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

Jquery 实现表单提交按钮变灰,防止多次点击提交重复数据

表单提交时候我们应该控制提交按钮,不能点击多次进行数据的重复提交。要不然就会有冗余的重复的数据在系统中,造成系统出现数据垃圾。jQuery很简单的就可以实现对表单提交按钮控制,下面就是相关的例子和代码。 [html] view plain copy print?<formaction="${pageContext.servletCon...

WGH100817的博客 175

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

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

&lt;script type="text/javascript"&gt; /* jquer 脚本,避免重复提交 隐藏点击的submit,后在他之后插入同名button伪装成被隐藏的submit 最后禁用全部可见的submit和button 最终效果:点击按钮提交表单后,点击后退按钮,返回提交表单页面,提交按钮已被禁用 注:此方法毕竟在客户端处理,防君子不防小人 */ $(document...

自强不息 136

jsp防止按钮重复提交

原理:在session中插入标记,在一次session中只能提交一次 下面是代码: index.jsp<body> <% String tokenValue = new Date().getTime() + ""; %> <form action="${pageContext.request.contextPath}/servlet/controler"

JunXia 2894

前台限制默认表单重复提交(jquery 实现方式 防止因为网络延迟而产生的表单重复提交)

默认表单提交指的是,利用或者 实现的表单提交, 例如, /repeat/hello" method="post" > 默认提交 button submit方式 实现思路:同防止ajax重复提交,维护一个提交按钮队列,通过jquery监听所有submit按钮的提交,如果在提交队列中,那么不再提交,如果不再提交队列中,那么放入提交队列,并提交。

wangjun5159的专栏 2935

防止快速连续点击按钮重复提交数据之二(定时器实现)

动态给div添加点击事件,当点击完成后就将当前点击事件移除,并提交数据,然后使用定时器间隔一定时间重复给div上绑定点击事件 事例代码如下(1):提交单纯得div jQuery防止click双击多次执行及传递动态函数方法 显示测试结果: 点击我吧 var iTime =null; $("#div").on('click', d

qq_15783243的博客 1731

jquery中关于Chrome跟IE8禁用其中的submit按钮后会提交不了表单的解决方法

2019独角兽企业重金招聘Python工程师标准>>> ...

weixin_33938733的博客 208

jquery submit 解决多次提交

jquery submit 解决多次提交 web应用中常见的问题就是多次提交,由于表单提交的延迟,有时几秒或者更长,让用户有机会多次点击提交按钮,从而导致服务器端代码的种种麻烦。 为了解决这个问题,我们可以绑定处理程序到表单的提交事件上,在提交按钮第一次点击之后禁止提交按钮。 $('#notice_rotationlist_add_dialog_form').submit().attr('dis...

牛奔的博客 674

提交表单后禁用提交按钮

<formid="myform"action="someUrl.php"method="get"> 2<inputname="username"/> 3<!--somemoreformfields--> 4<inputid="submit"type="s...

weixin_33795093的博客 567

浅谈防止表单或者按钮重复点击

浅谈防止表单或者按钮重复点击 今天遇到一个按钮多次点击导致数据重复提交的问题。从前端角度来看,这样首先影响了程序的正确性,其次用户体验很差。 于是开心的打开google。搜索关键字表单 重复 提交打开排名靠前的几篇文章,然后继续搜索prevent form submit twice 后来发现高大上的表述为prevent duclicate submit 闲话不多...

weixin_34034261的博客 188

防止表单重复提交(借助jquery实现)

$("input:submit").each(function() { var srcclick = $(this).attr("onclick"); if(typeof(srcclick)=="function"){ $(this).click(function() { if (srcclick()) { setdisabled(this); return true; } return fals

380
上一篇: linux java 环境变量设置
下一篇: JSON ajax 页面输出工具
fdsafds
博客等级 码龄20年 0粉丝 37原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值