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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:09:25+00:00 2026-06-15T05:09:25+00:00

I am trying to capture the selected checkboxes in order to send that off

  • 0

I am trying to capture the selected checkboxes in order to send that off via AJAX. But I am only getting the selected element one click to late; that is, my first click on a checkbox is not recognized by the “elm” loop as a checkbox being selected; only when I click a second time, it spits out that element. On a third click it spits out first and second click, but not third.

$(".datatype").mouseup(function() 
{
    /* check keyword */
    var searchbox = document.forms['formIndex'].searchbox.value;

    /* check datasetype */
    var vals = [], datasettype =  document.forms['formIndex']['datasettype[]'];
    for(var i=0,elm;elm = datasettype[i];i++)
    {
        alert(i + ': ' + elm.value);
        if(elm.checked)
        {
            alert(i + ': ' + elm.value);
            vals.push(elm.value);
        }
    }
    contents = vals.join(',');

HTML code:

<fieldset>
  <legend style="font-size: 1.2em; font-weight: bold; border: 1px solid aaa" for="selectedRegion">Data Set Type</legend>
  <input type="checkbox" class="datatype" name="datasettype[]" value="1">National<br />
  <input type="checkbox" class="datatype" name="datasettype[]" value="3">Sub-Regional<br />
  <input type="checkbox" class="datatype" name="datasettype[]" value="2">Regional<br />

Can anyone give me a hint why that would be? Thanks a lot 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-15T05:09:27+00:00Added an answer on June 15, 2026 at 5:09 am

    I think you need to use change event instead of mouseup

    $(".datatype").change(function() 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I trying to capture the target element's id when function fired, but this keyword
I'm trying to capture http request that occurs in a callback function : //
I am trying to capture urls in an html page that is being repeated
I'm trying to create a view that contains a list of checkboxes that is
WebDriver->I am trying to capture the 'date' selected from a UI-Calender. I want to
just now I was trying to capture the F1 key on the form, but
I am trying to capture a session ID from a URL so that the
I am trying to create a click event that will capture: What the current
I am trying capture UIIMage with UIGraphicsBeginImageContext(); but my code capture the whole screen
I am trying to capture output from an install script (that uses scp) and

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.