I am currently selecting all the input fields of a form using jQuery in the following way:
$('#new_user_form *').filter(':input').each(function(key, value) {
This works fine although it selects the submit input as well which I don't want it to do. Is there a simple way of making it ignore the submit button?
Thanks!
You can use :not()
:
$('#new_user_form input:not([type="submit"])')
Also, be careful with :input
and other non-standard selectors. They don't have the same speed benefit as native selectors on browsers that implement document.querySelectorAll
.
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