.attr('disabled,'disabled')或.attr('disabled',true)用于禁用输入 [英] .attr('disabled', 'disabled') or .attr('disabled', true) for disabling input

查看:1226
本文介绍了.attr('disabled,'disabled')或.attr('disabled',true)用于禁用输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

.attr('disabled', 'disabled').attr('disabled', true)都可以在我的代码中使用,但我只是想知道:两者中哪个更有效和/或哪个更常用?真的有区别吗?性能方面,也许吗?

Both .attr('disabled', 'disabled') and .attr('disabled', true) work in my code, but I'm just wondering: which among the two is more efficient and/or which is more used? Is there really a difference? Performance-wise, maybe?

推荐答案

应该没有任何区别. 但是从jQuery1.6 +开始,您应该使用$("input").prop('disabled', true);

Should not make any difference. But from jQuery1.6+ you should use $("input").prop('disabled', true);

这篇关于.attr('disabled,'disabled')或.attr('disabled',true)用于禁用输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆