1、a中含有data-reveal-id的html代码:
<a href="#" class="disabled" data-reveal-id="modal-port">Modify</a>
<div id="modal-port" class="reveal-modal small" data-reveal aria-labelledby="modalTitle" aria-hidden="true" role="dialog">
<a class="close-reveal-modal" aria-label="Close">×</a>
</div>
2、禁用的js代码如下:
if (conditionToEnable) {
$("#modal-button").removeClass("disabled")
$("#modal-button").attr("data-reveal-id", $(this).attr("modal-id"))
} else {
$("#modal-button").addClass("disabled")
$("#modal-button").removeAttr("data-reveal-id")
}
removeAttr("data-reveal-id")是通过remove来禁用的。
var wait = 3function time(o) {
if (wait == 0) {
o.removeAttribute("disabled")
o.value = "免费获取验证码"
wait = 60
} else {
o.setAttribute("disabled", true)
o.value = "(" + wait + ")秒后重新发送"
wait--
setTimeout(function () {
time(o)
},
1000)
}
}
$("#id").click(function(){
time(document.getElementById("要禁用的控件id"))//调用
})