How is it possible with jQuery, to find all inputs/textareas there is inside a form?
I know you can use .children and then .each, but i’m building a validation class and i dont know if some of the input has a wrapper because it should work for all my forms.
$('input[type=submit]').click(function(){
$(this).closest('form').children('input,textarea').each(function(){
// do something with the input/textarea
)};
});
This works, but only if the inputs is right after the form…
Use
.find()to get all descendants which matches a given selector: