JQuery选择没有禁用的所有元素并且没有只读? [英] JQuery select all elements without disabled AND no readonly?
本文介绍了JQuery选择没有禁用的所有元素并且没有只读?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用JQuery,我需要选择具有条件的所有INPUT元素:
With JQuery, I need to select ALL INPUT elements with a condition:
'未禁用'(:禁用)'AND''NOT readonly',
'NOT disabled' (:disabled) 'AND' 'NOT readonly',
然后我要将css样式更改为查询结果。
and then i'm gonna change css style to query result.
更新:我需要按顺序迭代结果..
UPDATE: I need iterate over result in order..
推荐答案
详情:
$('input:not(:disabled):not([readonly])').each(function() {
$(this).foo();
});
或更好:
$('input:enabled:not([readonly])').each(function() {
$(this).foo();
});
编辑:
从您的回答中,有一个更好的做你想做的事情:
From your following answer, theres a better way of doing what you want to do:
$('input').focus(function(e) {
if($(this).is(':disabled, [readonly]')) {
$(this).next().focus();
e.preventDefault();
}
});
这篇关于JQuery选择没有禁用的所有元素并且没有只读?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文