【发布时间】:2011-03-03 16:50:43
【问题描述】:
使用 JQuery,我需要选择具有条件的所有 INPUT 元素:
'NOT disabled' (:disabled) 'AND' 'NOT readonly',
然后我将更改 css 样式以查询结果。
更新:我需要按顺序迭代结果..
【问题讨论】:
标签: jquery
使用 JQuery,我需要选择具有条件的所有 INPUT 元素:
'NOT disabled' (:disabled) 'AND' 'NOT readonly',
然后我将更改 css 样式以查询结果。
更新:我需要按顺序迭代结果..
【问题讨论】:
标签: jquery
详细说明:
$('input:not(:disabled):not([readonly])').each(function() {
$(this).foo();
});
或者更好:
$('input:enabled:not([readonly])').each(function() {
$(this).foo();
});
编辑: 从您的以下答案中,有一种更好的方法可以做您想做的事情:
$('input').focus(function(e) {
if($(this).is(':disabled, [readonly]')) {
$(this).next().focus();
e.preventDefault();
}
});
【讨论】:
我真的需要这些:
$('input:not(input:enabled:not([readonly]))').each(function() {
//skip focus to readonly input
$(this).focus(function(){
$(this).nextAll('input:enabled:not([readonly])')[0].focus();
});
});
【讨论】: