本文介绍了.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)用于禁用输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!