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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:41:43+00:00 2026-06-11T19:41:43+00:00

I need to get values for each checkbox and break movement to another page

  • 0

I need to get values for each checkbox and break movement to another page if the user doesn’t check any box.

there is an error but I cant recognize it

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

        if($('#Search').val() == "")
        {alert('please enter your domain without Extuntison');return false;}

        results.style.display = 'none';
        $('#results').html('');
        loading.style.display = 'inline';

        $.post('../domain_checker/process.php?domain=' + escape($('#Search').val()),{
        }, function(response){


            results.style.display = 'block';
            $('#results').html(unescape(response)); 
            loading.style.display = 'none';

            //$('#results').animate({height : '450px' }, 2000);

            results.style.height = '400px';
        });

        return false;
    });


       $(function(){
          $('#order_Now').click(function(){
             var count = $("[type='checkbox']:checked").length;
             var val = [];
             for(i=0;i<count;i++){
                $(':checkbox:checked').each(function(i){
                   val[i] = $(this).val();
                });
             }      
          });
       });

and this html page when load ajax

 <form action="ordedomain.php" name="formdomain" method="post" id="formdomain"  onclick="check_domain_checkBox()">

     <div id="results" style="width:450px;" align="left">



     </div> 
     </form>

and this code reloade by ajax in page php

       <form action="ordedomain.php" name="formdomain" method="post" id="formdomain"  onclick="check_domain_checkBox()">

<input type="checkbox" value="a" id="arrDomain" name="arrDomain">a
<input type="checkbox" value="b" id="arrDomain" name="arrDomain">b
<input type="checkbox" value="c" id="arrDomain" name="arrDomain">c

        </form>
  • 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-11T19:41:44+00:00Added an answer on June 11, 2026 at 7:41 pm

    That’s simple:

    var vals = [];
    $(":checkbox").each(function() {
        if (this.checked)
           vals.push(this.value);
    });
    var count = vals.length;
    

    I’m not sure what the for-loop is doing in your code as you already have the each().

    Now you can easily get the count in your submit handler, if it equals 0 prevent the submit.

    Also, you shouldn’t use submit buttons if you want checkboxes; and you can’t use an id multiple times (it needs to be unique), use the name attribute instead:

    <form action="ordedomain.php" name="formdomain" method="post" id="formdomain">
      <label><input type="checkbox" name="domain" value="1"> Order now 1</label>
      <label><input type="checkbox" name="domain" value="2"> Order now 2</label>
      <label><input type="checkbox" name="domain" value="3"> Order now 3</label>
      <label><input type="checkbox" name="domain" value="4"> Order now 5</label>
      <input type="text" id="search" name="search">
      <div id="results" style="display:none;"></div>
      <img id="loading" src="…" style="display:none;"></div>
    </form>
    
    // onDOMready
    var form = $("#formdomain"),
        search = form.find("#search"),
        checkboxes = form.find(":checkbox"),
        results = form.find("#results"),
        loading = form.find("#loading");
    form.submit(function(evt) {
        var sval = search.val(),
            checked = checkboxes.filter(":checked"),
            dvals = [];
        if (!sval) {
            alert("Please enter domain (without extension)");
        } else if (!checked.length) {
            alert("Please tick at least one domain extension");
        } else {
            checked.each(function() {
                dvals.push(this.value);
            });
            $.post('../domain_checker/process.php', {
                domain: sval,
                extensions: dvals
            }, function(resonse) {
                loading.hide();
                results.html(response).show();
            });
            loading.show();
            results.hide();
        }
        evt.preventDefault();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There are multiple <input type=checkbox value=... /> in the page. I need to get
I need to get values of these check boxes with same name through HTTP
I need to get some values of HTML web page. I want only the
Is there a way to break out of a <g:each>? I have a page
I need to get the id from each checked checkbox. Right now I am
I have 3 buttons with same ID. I need to get each button's value
In C# i need to get all values of a particular property from an
I'm stuck here: I need to get the values of org.jboss.system.server.ServerInfo With the code
I have the following xml that I need to get 2 values (see *
I'm working in a project that need to get SVD (Single Values Decomposition) for

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.