admin管理员组文章数量:1430953
I'm trying to select elements with multiple conditions, for example I'm doing the following at the moment:
$('#myspan').find('input:visible').each(myfunc);
Although I know you can do things like $('#myspan input:visible')
but it didn't work for me. I need to check for inputs within the span #myspan
which are visible and are checked. Any ideas?
I'm trying to select elements with multiple conditions, for example I'm doing the following at the moment:
$('#myspan').find('input:visible').each(myfunc);
Although I know you can do things like $('#myspan input:visible')
but it didn't work for me. I need to check for inputs within the span #myspan
which are visible and are checked. Any ideas?
2 Answers
Reset to default 6Try:
$("#myspan :checked:visible").each(function() {
// do stuff
});
$('input:visible', '#myspan').find(':checked').each(function() {
alert(this.id);
});
Should do the trick. I like seperating things because I like to think it helps jQuery parse better.
本文标签: javascriptMultiConditional Selectors in jQueryStack Overflow
版权声明:本文标题:javascript - Multi-Conditional Selectors in jQuery - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745477258a2660016.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论