Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8670105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T18:38:10+00:00 2026-06-12T18:38:10+00:00

Is there an easy way (without listing them all separately) in jquery to select

  • 0

Is there an easy way (without listing them all separately) in jquery to select all form elements and only form elements.

I can’t use children() etc because the form contains other HTML.

E.g:

$("form").each(function(){
    let $inputs = $("input, textarea, select", this);
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T18:38:11+00:00Added an answer on June 12, 2026 at 6:38 pm

    Edit: As pointed out in comments (Mario Awad & Brock Hensley), use .find to get the children

    $("form").each(function(){
        $(this).find(':input') //<-- Should return all input elements in that specific form.
    });
    

    forms also have an elements collection, sometimes this differs from children such as when the form tag is in a table and is not closed.

    var summary = [];
    $('form').each(function () {
        summary.push('Form ' + this.id + ' has ' + $(this).find(':input').length + ' child(ren).');
        summary.push('Form ' + this.id + ' has ' + this.elements.length + ' form element(s).');
    });
    
    $('#results').html(summary.join('<br />'));
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <form id="A" style="display: none;">
        <input type="text" />
        <button>Submit</button>
    </form>
    <form id="B" style="display: none;">
        <select><option>A</option></select>
        <button>Submit</button>
    </form>
    
    <table bgcolor="white" cellpadding="12" border="1" style="display: none;">
    <tr><td colspan="2"><center><h1><i><b>Login
    Area</b></i></h1></center></td></tr>
    <tr><td><h1><i><b>UserID:</b></i></h1></td><td><form id="login" name="login" method="post"><input
    name="id" type="text"></td></tr>
    <tr><td><h1><i><b>Password:</b></i></h1></td><td><input name="pass"
    type="password"></td></tr>
    <tr><td><center><input type="button" value="Login"
    onClick="pasuser(this.form)"></center></td><td><center><br /><input
    type="Reset"></form></td></tr></table></center>
    <div id="results"></div>

    May be :input selector is what you want

    $(“form”).each(function(){
    $(‘:input’, this)//<– Should return all input elements in that specific form.
    });

    As pointed out in docs

    To achieve the best performance when using :input to select elements, first select the elements using a pure CSS selector, then use .filter(“:input”).

    You can use like below,

    $("form").each(function(){
        $(this).filter(':input') //<-- Should return all input elements in that specific form.
    });
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an easy way to use SerializationStreamWriter for custom purposes without writing an
Is there an easy way without having to use java library to concat two
Is there an easy way to sort a without resorting to the use of
Is there an easy way (without downloading any plugins) to connect to a MySQL
Is there an easy way to remove comments from a C/C++ source file without
Is there an easy way in javascript to only escape certain ranges of control
Is there an easy way to use UIElement.Effect in WPF to shift the color
Is there an easy way to read/write a nibble in a byte without using
Is there an easy way to get to the basename (file name without extension)
Is there an easy way to expose all translated strings to javascript? I want

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.