First we talk about the button.
Button or Submit
Solution 1: disable_with => "Begin Service"
Rails can use :disable_with => "Begin Service".
Example:
= button_tag "Begin Service", root_path, :disable_with => "Begin Service"
This will not work when use RailsVersion Under(maybe 3.2) for image_submit_button.
So we can fix it like this:
Solution 2:
$("#an_image_submit").attr("disabled", true)
Link Add class = 'nodouble' to a link
Solution 1:
$(".nodouble").live "click", ->
$(this).click -> return false
Solution 2:
$("body").on "click", ".nodouble", (e) ->
$(this).attr "onclick", ""
$(this).on "click", (e) -> false
Solution 3: For Ajax query: CSS:
#'pointer-events: none' will not work in IE, So this solution is not suitable for IE. This solution's benifit is that it will change the CSS of the clicked link.
a.disabled { opacity: 0.5; pointer-events: none; cursor: default }
$(".nodouble").livequery "click", (e) ->
e.preventDefault()
a = $(this) a.addClass('disabled')
Because Solution 3 can not work with IE, So we should do more work like this: Solutions 4
$(".nodouble").livequery "click", (e) ->
e.preventDefault()
a = $(this) return false if a.data("clicked") a.data("clicked", true)
a.addClass('disabled')
分享到:
相关推荐
Prevent-Screen-Off Featured in: Medium What is this library for? Ideally, when you user is looking at the screen, your application should not turn the screen off. This is huge deal for the ...
防止双重提交 jQuery 插件 概括 这个插件的目的是通过只允许表单提交一次来防止重复的表单提交。
Prevent-Screen-Off:这个库实现当用户看屏幕时,将一直保持屏幕不关掉
GitHub源-https://github.com/aghorler/WebRTC-Leak-Prevent-Toggle CHANGELOG 1.0.14-自动保存选项。 1.0.11-现在,选件在首次安装时会自动打开,并提供新的说明。 1.0.10-更改GitHub用户名,非常小的修复。 1.0.9-...
防止复制粘贴 防止复制和粘贴的 Javascript 库。 这会为本身不支持它的... 用法 <!-- Include library --> [removed][removed] ...-- Input with onpaste property -->...input type="text" onpaste="return false;...
npm install prevent-backspace 成分 component install jprichardson/prevent-backspace 例子 var preventBackspace = require ( 'prevent-backspace' ) preventBackspace ( ) //hitting `backspace` outside of...
Digital signatures provide part of the solution, but the mainbenefits are lost if a trusted third party is still required to prevent double-spending.We propose a solution to the double-spending ...
$ yarn add prevent-pull-refresh 用法 import 'prevent-pull-refresh' ; 要么 < script src =" //unpkg.com/prevent-pull-refresh " > </ script > 执照 麻省理工学院:copyright:
prevent-window-scroll a light script with prevent body scroll when part scroll, and it has no dependancy. 弹层局部滚动时,阻止页面整体滚动 特点: 1、无依赖,原生js实现; 2、经测试兼容90%以上的浏览器;...
"Prevent Running" hajacks several system API to prevent not-in-use apps in prevent list from running or keep running. Furthermore, it applies to system apps too, specially, support google-family apps...
$ npm install prevent-bounce --save 如何使用 浏览器 < script src =" ./prevent-bounce.js " > </ script > < script > var preventBounce = new PreventBounce ( ) ; preventBounce . ...
语言:English (UK) 阻止CTRL-W关闭您的AWS CloudShell窗口。 防止在意外按下CTRL-W时关闭AWS CloudShell的窗口。
035-防止重复表单提交-弹簧-MVC
GitHub源码-https://github.com/aghorler/WebRTC-Leak-Prevent CHANGELOG 1.0.13 / 14-自动保存选项。 1.0.12-将打开选项功能绑定到工具栏图标。 1.0.11-现在,选件在首次安装时会自动打开,并提供新的说明。
GitHub源代码 - https://github.com/aghorler/WebRTC-Leak-Prevent-Toggle CHANGELOG 1.0.11 - 选项现在在第一次安装时自动打开,新的描述。 1.0.10 - 更改GitHub用户名,修复很少。 1.0.9 - 进一步的遗留支持,错误...
2,等同于在子组件中: 子组件内部处理click事件然后向外发送click事件:$emit(“click”.fn) <Item xss=removed></Item> 补充知识:vue——组件间(兄弟组件间)事件派发与接收 法一 main.js 在初始化vue之前,给...
防止自动填充.js 尝试阻止浏览器自动填充功能访问表单输入。 专为对抗 Chrome 的自动填充功能而创建。 Chrome 似乎并不关心我在任何类型的地址表单上的“自动完成”设置,无论自动完成属性放在哪个元素上。...
Buffer Overflow Attacks - Detect Exploit Prevent.rar
流星防止退格 是一个客户端 JavaScript 组件,...将项目添加到您的 Meteor 项目: meteor add uzumaxy:prevent-backspace 。 之后退格将不会用于导航。 执照 meteor-prevent-backspace项目获得了麻省理工学院的许可。
$ yarn add prevent-orientation 或者 < script src =" //unpkg.com/prevent-orientation " > </ script > 用法 import { PreventOrientation } from 'prevent-orientation' ; // Prevent to portrait ...