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.
You could add the attribute selector after each element selector:
Here’s a working example.
Also note that (in browsers that support
querySelectorAll, at least) this should be significantly faster than using.filter():