Use :any
pseudo-class;
document.querySelectorAll('[id^=' + tagId + ']:-webkit-any(input, textarea, select)');
Right now, you will need to prefix this with -webkit-
for Chrome and Safari, or -moz
for Firefox; no IE support. This is likely to be standardized eventually under the name :matches
. See MDN documentation here.
However, managing DOM elements via their IDs, as if they were named variables in some giant global namespace, is an anti-pattern. It is highly likely that there are better ways to find and keep track of elements than to assign a bunch of IDs over here in your code, then over there do getElementById
or equivalent every time you turn around in order to find it again, much less doing the equivalent of a wildcard-like search.