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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:25:13+00:00 2026-05-25T22:25:13+00:00

I have problem in add new input:checkbox , when i adding new input and

  • 0

I have problem in add new input:checkbox, when i adding new input and checked on it next setup clicked on button i not have value for input:checkbox that was checked. how is fix it?

DEMO: http://jsfiddle.net/G4QRp/

$(function () {
    $('a.add_input').live('click', function (event) {
        event.preventDefault();
        var $class = '.' + $(this).closest('div.find_input').find('div').attr('class').split(" ")[0];
        var size_un = $($class).length;
        var $this = $(this),
            $div = $this.closest($class),
            $clone = $div.clone().hide().insertAfter($div).fadeIn('slow');
        $clone.find('.adda').not(':has(.remove_input)').append('<div class="mediumCell"><a href="" class="remove_input"></a></div>');
        $clone.find('input').val('').prop('checked', false);
        $this.remove();
        var size_un = $($class).length---1;
        $($class + ':last input:checkbox').prop('name', 'checkbox_units[' + size_un + '][]');
        console.log($($class + ':last input:checkbox').prop('name'));
    });
});
  • 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-05-25T22:25:15+00:00Added an answer on May 25, 2026 at 10:25 pm

    Your code always clears the value of all the checkboxes it adds:

        $clone.find('input').val('').prop('checked', false);
    

    It’s working fine, though it’s quite confusing. The alert correctly shows the checkboxes that are checked, but since your code has set the value to ” for each of them, well, it’s empty. If you change it like this:

        $clone.find('input').prop('checked', false);
    

    it shows the values to be the same as the original checkboxes.

    You might want to think about using “data-” attributes instead of the “class” string for storing things like that “add_units” class name.

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

Sidebar

Related Questions

I have a form that I generate new input fields to with javascript and
I have a problem adding an input with similar class( addinput_units ). In the
I have a problem: I've add a Jquery UI drag-n-drop widget to my page,
I have a problem where I have to add thirty-three integer vectors of equal
I have a little problem, I have an array and I want to add
I have to add some enum options to a database table. The problem being,
I have a nHibernate query like this ICriteria query = session.CreateCriteria(typeof(MyResult)) .Add(Expression.Eq(ResultTypeId, myResult.ResultTypeId)) Problem
I have problem in some JavaScript that I am writing where the Switch statement
I have a problem that has been consuming me for days. I have a
I have a UL and I'm working to dynamically add a new LI to

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.