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 8776171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:59:15+00:00 2026-06-13T18:59:15+00:00

Suppose I have a form with 20 rows as shown in the figure below:

  • 0

Suppose I have a form with 20 rows as shown in the figure below:
Form Structure

I’m naming the elements in the each row as:

1st row (Ambiance)    -> v1[requirement], v1[observation], v1[status], v1[remarks]
2nd row (TV Room)     -> v2[requirement], v2[observation], v2[status], v2[remarks]
3rd row (Cleanliness) -> v3[requirement], v3[observation], v3[status], v3[remarks]
.... and so on till 20th row

Using jquery or javascript can I find the number of rows present based on the names of the element? i.e., in this form name starts from v1 and ends at v20. So there are 20 rows.

UPDATE

The reason why I want the number of rows is because I plan to process the forms using:

for($i=1; $i<=$rowcount; $i++)
{
   $v.$i = $_POST['v'.$i];
   // then insert the first row into table and so on
}
  • 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-13T18:59:16+00:00Added an answer on June 13, 2026 at 6:59 pm

    This approach should work for you:

    var rowCount = $("#data-table tr").filter(function() {
        return $(this).find('[name^="v"]').length;
    }).length;
    

    This code will count only tose rows which have input with the name starting with v. I guess this is what you need.

    Quick demo: http://jsfiddle.net/dfsq/2P5cN/

    UPD
    As per Mark Reed’s comment we can make it even more simple:

    var rowCount = $('#data-table tr').has('[name^=v]').length;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have a form like this: Name:<input type=text name=xxx id=name/> Type:<select> <option>xx</option> <option>xx</option>
Suppose I have a few TextBoxes in a VBA form, called Text1,Text2,Text3. I'm looking
Suppose I have the following HTML: <form id=myform> <input type='checkbox' name='foo[]'/> Check 1<br/> <input
Suppose i have JSF page <h:body> <h:form id=formID prependId=false> <h:outputText id=randomID value=#{randomNumber.random}/> <h:commandButton id=buttonID
I have a contact form which is suppose to go to a thank you
Suppose you're building an HTML form and you want to have 2 or more
Suppose I have a form on a page at this location... http://mydomain.com/myform.htm And the
Suppose I have a form opened via the .ShowDialog() method. At some point I
Suppose I have a form like this: <form id='myform'> Favorite colors? <input type='checkbox' name='color'
I have a design questions about this scenario: Suppose you have a form with

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.