I usually just do this:
$("#formid input, #formid select, #formid textarea")
But is there any shorthand for this, like..
$("#formid All-Form-Elements")
?
You seem to be looking for the :input selector:
var formElements = $("#formid :input");
Note that it also matches <button>
elements.
Use the :input
selector, which selects all <input>
, <textarea>
, <select>
and <button>
elements.
$("#formid :input")
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