Selecting multiple elements with querySelectorAll

Viewed 16998

I have this piece of code:

var requiredFields = el.querySelectorAll("input[required]:not(:disabled):not([readonly]):not([type=hidden])");

If I want to add the textarea and select to the query I'm ending up with this:

var requiredFields = el.querySelectorAll("input[required]:not(:disabled):not([readonly]):not([type=hidden])"+  
",select[required]:not(:disabled):not([readonly]):not([type=hidden])"+
",textarea[required]:not(:disabled):not([readonly]):not([type=hidden])");

My feeling says this could be better.. but how?

Bonus: Please give me a good resource for querySelectorAll function.

2 Answers
Related