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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:03:11+00:00 2026-05-23T14:03:11+00:00

How to print the multiple array values in jquery html() function? $(‘#mer’).click( function() {

  • 0

How to print the multiple array values in jquery html() function?

    $('#mer').click( function() {

      var checked = [];
      var attr = [];
      var attr0 = [];
      var unchecked = [];  
     //$('input[type="checkbox"]').each(function(){
     $('input:checkbox[name="attr[]"]').each(function(){

        //attr.push($(this).next("label").text());
        if( this.checked ){
          checked.push(this);
          attr.push($(this).next("label").text());

        } else{
          unchecked.push(this);
          attr0.push($(this).next("label").text());
        }
      });

        //checked check box show
        for (j=0; j < checked.length; j++)
          {
            //alert(checked[j]);
            $('#ch').append($('<li>').html(checked[j]+attr[j]);
          }

        //unchecked check box show
        for (j=0; j < unchecked.length; j++)
          {
            //alert(checked[j]);
            $('#ch').append($('<li>').html(unchecked[j]+attr0[j]);
          }

       $('input[type="checkbox"]:checked').attr('disabled', true);  
       $('.checklist').hide();
       $('#ch').show();   
    });
  • 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-23T14:03:12+00:00Added an answer on May 23, 2026 at 2:03 pm

    I think this code does all that you want:

    $('#mer').click( function() {       
       $(':checkbox[name="attr[]"]:checked').add(':checkbox[name="attr[]"]:not(:checked)').each(function(){
          var text = $(this).next("label").text();
          $('#ch').append($('<li/>').append($(this).clone()).append(text));
       });
       $(':checkbox:checked').attr('disabled', true);  
       $('.checklist').hide();
       $('#ch').show();   
    });
    

    Hope this helps. Cheers

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

Sidebar

Related Questions

I've referred to this post: Post array of multiple checkbox values And this jQuery
I've wrote a simple array, and I would use it to print an html
I would like to know if there is any easy way to print multiple
I want to create multiple versions of print-friendly pages from a single page. I
UPDATE: Here's my solution (inspired by accepted answer): function log(msg, values) { if(config.log ==
Please help me, i need to merge multiple arrays then sorting it by array
I have a multiple select and I made a function to check several parameters,
Im trying to send an email to multiple addresses, so I wrote function that
I did some digging and I understand that the array means there are multiple
How do I print multiple searches from a linear search in C? for (i=0;

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.