【发布时间】:2011-12-28 18:19:29
【问题描述】:
我现在正在处理一些复杂的表格。
只是想知道,有没有更好的方法来做到这一点:
$('.selector').each( function(){
$("input", this).prop('disabled', true);
$("select", this).prop('disabled', true);
$("label", this).prop('disabled', true);
$("textarea", this).prop('disabled', true);
});
我想选择this 中的所有输入(当前循环通过.selector)。
我这样做正确吗?
【问题讨论】:
-
是的,从技术上讲。尽管@BoltClock 下面的回答是一种更好的方法。
标签: javascript jquery html jquery-selectors