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

  • Home
  • SEARCH
  • 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 8096929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:35:49+00:00 2026-06-05T21:35:49+00:00

I have a dynamic form that users can add/delete sets of input fields. I

  • 0

I have a dynamic form that users can add/delete sets of input fields. I want to disable the delete form fields button when there is x amount of inputs left, so I thought I would count the number of inputs left on the onclick for the delete button, and then when there was only x amount of inputs left I would disable the delete button so they cant delete the last set of inputs.

$('#btnRemove').on('click', function() {
    $('.clonedInput').last().remove();
    if count of inputs = 7;
    $('#btnRemove').attr('disabled','disabled');
});

‘if count of inputs = 7’ is what I need the code for! Any help?

  • 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-05T21:35:52+00:00Added an answer on June 5, 2026 at 9:35 pm

    I think you’re just looking for

    if ($('.clonedInput').length == 7) {
      // do stuff
    }
    

    Selectors simply return an array of jQuery elements. To access the length of an array in JavaScript, you simply use the .length property.

    [1,2,3].length //=> 3 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a dynamic form that allow to add many fields dynamically, I Know
I have a dynamic form that adds users to the site, made so you
I have form where are 2 input fields and then i have dynamic dataTables
I have... a dynamic populated select box several input boxes a submit button form
I have a form that has all the fields pulled dynamic from a database
I have a dynamic form that I've written in rails. I want to be
I have a document with a dynamic UI--users can add rows to an existing
I have a dynamic form that is to be displayed using an iPad. This
I have a form that is populated with dynamic form elements based on a
I have a form with a stage that has a dynamic number of groups

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.