按钮启用_提交按钮启用

按钮启用

"Enabling" you ask? Yes. We all know how to disable the submit upon form submission and the reasons for doing so, but what about re-enabling the submit button after an allotted amount of time. After all, what if the user presses the "stop" button immediately after submitting the form? They'd be screwed. Why not re-enable the submit button after an allotted amount of time so that the user may re-submit?

您问“启用”吗? 是。 我们都知道如何在提交表单时禁用提交功能以及这样做的原因,但是如何在分配的时间后重新启用提交按钮呢? 毕竟,如果用户在提交表单后立即按下“停止”按钮怎么办? 他们会被搞砸。 为什么不在指定的时间后重新启用提交按钮,以便用户可以重新提交?

MooTools JavaScript (The MooTools JavaScript)


window.addEvent('domready',function() {
		var subber = $('submit');
		subber.addEvent('click',function() {
			subber.set('value','Submitting...').disabled = true;
			(function() { subber.disabled = false; subber.set('value','Resubmit'); }).delay(10000); // how much time?  10 seconds
		});
	});


Of course, this isn't ideal in all situations. It is, however, a nice touch if your system can accommodate for it.

当然,这并非在所有情况下都是理想的。 但是,如果您的系统可以容纳它,那将是一个不错的选择。

Update: Upon submission, the button's message changes to "submitting..." and once enabled, the message changes to "Resubmit." Thank you to Facundo Corradini for the suggestion!

更新:提交后,按钮的消息更改为“正在提交...”,启用后,该消息更改为“重新提交”。 感谢Facundo Corradini的建议!

翻译自: https://davidwalsh.name/submit-button-enable

按钮启用

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值