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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:27:58+00:00 2026-05-26T01:27:58+00:00

I have a primary product array var prodArr = new Array(‘Microsoft’, ‘Google’); Using prodArr

  • 0

I have a primary product array

var prodArr = new Array('Microsoft', 'Google');

Using prodArr as the primary loop, I created a UL LI checkboxtree which looks as follows:

<ul id="prodTree">
  <li>
    <input name="prod" id="prod" type="checkbox" value="Microsoft">
    <label>Microsoft</label>
    <ul id="MicrosoftTree">
      <li>
          <input id="prod" name="prod" type="checkbox" value="msp1">
          <label>Microsoft Product 1</label>
      </li>
      <li>
          <input id="prod" name="prod" type="checkbox" value="msp2">
          <label>Microsoft Product 2</label>
      </li>
    </ul>
    <li>
    <input name="prod" id="prod" type="checkbox" value="Google">
    <label>Google</label>
    <ul id="GoogleTree">
      <li>
          <input id="prod" name="prod" type="checkbox" value="gp1">
          <label>Google Product 1</label>
      </li>
      <li>
          <input id="prod" name="prod" type="checkbox" value="gp2">
          <label>Google Product 2</label>
      </li>
    </ul>
</ul>

On click of a button, I want to use prodArr and loop through every UL and group all the checkbox checked and create a textbox out of it. Lets assume ‘msp1’, ‘msp2’ and ‘msp9’ Microsoft products were selected. Example:

<input type='text' id='Microsoft' value='msp1, msp2, msp9' />

I have tried. Please 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-05-26T01:27:58+00:00Added an answer on May 26, 2026 at 1:27 am

    You can use the :checked pseudo-selector to select only checked checkboxes, and you can iterate over the matched set and get the values using val:

    $("#button").click(function() {
        $("#prodTree :checkbox:checked").each(function() {
            var value = $(this).val();
        });
    });
    

    Here’s a working example of the above.

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

Sidebar

Related Questions

I have created 2 table.Brand and Product.In both table one id is primary key
I have a product table which simplifies to this: create table product(id int primary
I have a primary link accommodation, then i have created a view , called
I have a table created using the query CREATE TABLE branch_dim ( branch_id numeric(18,0)
I have a SQL lookup table like this: CREATE TABLE Product(Id INT IDENTITY PRIMARY
I have a MySQL database with 60 tables. Most of the tables have primary
I have a primary key set up to auto increment. I am doing multiple
I have a primary table for Articles that is linked by a join table
Should I always have a primary key in my database tables? Let's take the
Is It Possible to have a primary key and auto increment key associated 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.