1.Readonly只针对input(text/password)和textarea有效,而disabled对于所有的表单元素有效,包括select,radio,checkbox,button等。
2.在表单元素使用了disabled后,我们将表单以POST或者GET的方式提交的话,这个元素的值不会被传递出去,而readonly会将该值传递出去.
3.disabled后不能触发JS事件,而readonly可以触发
<button class="send">发送验证码</button>
var times = 60, // 时间设置60秒
timer = null;
$('.send').click(function(event) {
timer = setInterval(function () { // 计时开始
times--;
if (times <= 0) {
$('.send').html('发送验证码');
clearInterval(timer);
$('.send').attr('disabled',false);
times = 60;
} else {
$('.send').html(times + '秒后重试');
$('.send').attr('disabled',true);
}
}, 1000);
});