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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:57:59+00:00 2026-05-16T09:57:59+00:00

now i get value if i selected checkbox(id which was selected), but how get

  • 0

now i get value if i selected checkbox(id which was selected),
but how get value when i unselected (id which was unselected)?

For example I push on 1, and i get value 1. When I unselect 1, i get value 1.
I hope you understand my problem.

<script>
$(document).ready(function()
{
    $("input[type=checkbox]").change(function(event){
        $("#result").html("&id=" + this.value);
    });
});
</script>
</head>                                                                 
<body>                                                                
<input type="checkbox" name="checkbox_pref" value = "1"/>1
<input type="checkbox" name="checkbox_pref" value = "2"/>2
<input type="checkbox" name="checkbox_pref" value = "3"/>3 
<div id="result">result ...</div>
  • 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-16T09:58:00+00:00Added an answer on May 16, 2026 at 9:58 am

    I simply create an array with all the checked values.

    Then i can use join to create string out of it for later use.

    $(document).ready(function() {
        var $inputs = $("input[type=checkbox]");
        $inputs.change(function(event){
            var list = [];
            $inputs.filter(':checked').each(function() {
                list.push($(this).val());
            });
            $("#result").html("&id=" + list.join(",")); // Produces: &id = 1,2,3 (If they were all checked)
        });
    });
    

    ​

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

Sidebar

Related Questions

I have the following Nant Script snippet. <zip zipfile=${devEnvironment}..\dev-${datetime::get-year(datetime::now())}${datetime::get-month(datetime::now())}${datetime::get-day(datetime::now())}.zip> <fileset basedir=${devEnvironment}> <include name=**/*/> </fileset>
I have my front end script which has the following jQuery code: $.get(/backend/post.php, {
When I use DateTime.Now I get the date and time from the server point
I asked before about pixel-pushing, and have now managed to get far enough to
Now that I know C++ I want to get into desktop application that have
Every now and then I get an error when I set up states in
I get an XML file From a web service. Now I want to get
So C# now allows you to use default(Foo) to get a recognized not filled
Now I have a stack of free time on my hands, I wanna get
Wanted to get some consensus around a UI feature I'm working on right now.

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.