[英]Jquery disable button until ready
我在此站点的中间http://offline.raileisure.com/
在右侧的“预订”部分,我需要能够禁用“立即预订”按钮,直到设置了日期,持续时间以及成人和儿童的人数。
我不知道该怎么做。
有任何想法吗 ??
谢谢李
您可以在所有表单元素上绑定到change
处理程序...例如:
$(':input').change(function() {
var complete;
// check if your form is complete here
// assumes the id of the button is 'bookNowButton'
if (!complete) $('#bookNowButton').attr('disabled', true);
else $('#bookNowButton').removeAttr('disabled');
});
为了简化启用/禁用功能,我还建议您将“立即预订”按钮更改为<input type="image" />
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.