How do I use an "AndAlso" in a selector?
jquery, jquery-selectors
Solution
You could add the attribute selector after each element selector:
var elems = $('input[id], select[id]');
Here's a working example.
Also note that (in browsers that support `querySelectorAll`, at least) this should be significantly faster than using `.filter()`:
Problem
I am looking to select all elements of type input and select, but only if their id isn't null. I've gotten this: ``` $('input, select') ``` for the element types and this: ``` $(*[id]) ``` for not null ids. I have no idea how to combine them into: ``` ((isSelect || isInput) && id != null) ``` Thanks in advance.