You can combine the :not()
and has-attribute selectors, like this:
$(":not([id])")
A few notes though, you currently have 2 elements with the same ID, this is invalid, IDs should be unique. Also you shouldn't use the selector exactly as I have it above, it should be within something, for example $("#test :not([id])")
to narrow it down...it's very expansive otherwise.