I'm trying to select all input elements except input type="submit/reset/button
I have tried to make a selector like this:
inputSelector = 'input:not(input[type=button], input[type=submit], input[type=reset]), textarea, select';
But this does not work, because the submit buttons always make into the final selection.
Any idea what's wrong with the above.
Thanks!
The :button selector selects button elements, and input elements with type=button.
Try modifying your selector to chain .not(...)
like:
var inputs = $('input, textarea, select') .not(':input[type=button], :input[type=submit], :input[type=reset]'); $(inputs).each(function() { console.log(this.type); });
This makes it (arguably) easier to read, and should work how you expect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With