I have the following:
$('#registration_form input[type=text], #registration_form input[type=password]')
And I feel it can be much better: faster and shorter
Something like
$('#registration_form input[type=text,password]')
EDIT: THIS is what I really wanted! Please take a look here
You can use find() with the :text and :password selectors to shorten your syntax:
$("#registration_form").find("input:text, input:password")
From a performance standpoint, it might be slightly faster, but not by much.
EDIT: Since :text and :password are not native CSS selectors, the following variation using filter() might be faster (and it's shorter in the first place):
$("#registration_form input").filter(":text, :password")
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