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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:17:30+00:00 2026-06-13T07:17:30+00:00

What I want to do is, return the value checked on each checkbox on

  • 0

What I want to do is, return the value checked on each checkbox on a modal-box to a text-box. This question is quite similar to this one, but the aim of the question is different. So please take a look both of them. 🙂

I’ve the code to initialize the modal-box:

<script>
var grid_modal_options = {
    height: 'auto',
    width: '80%',
    modal: true
};
function showProductsModalBox() {
    $("#products_modal_box").dialog(grid_modal_options);
    $("#products_modal_box").parent().appendTo('form:first');
}
</script>

<div id="products_modal_box" title="Products" style="display: none;">
  <div class="in">
    <div class="grid-12-12">
      <form id="products_modal_box_form" action="#" method="post">
        <a href=\"javascript:;\" onclick=\"$('#products_id_textbox').val(\"input[name='checkedID[]']:checked\");$('#products_modal_box').dialog('close')();\">Submit</a>
         <table>
          <thead>
            <tr>
              <th>&nbsp;</th>
              <th>Product</th>
            </tr>
          </thead>
          <!-- Query for read mysql goes here (I skipped this line because it's not the main thing I'm gonna ask since it's run well) /-->
          <tbody>
          <?php
            //read the results
            while($fetch = mysqli_fetch_array($r)) {                
              print "<tr>";
              print "  <td><input type='checkbox' name='checkedID' value='" . $fetch[0] . "' /></td>"; //--> How to get the value of $fetch[0], collect it and return to a textbox?
              print "  <td>" . $fetch[0] . "</td>"; //$fetch[0] == Product ID
              print "</tr>";
            }
          ?>
          </tbody>
        </table>
      </form>
    </div>
  </div>
</div>

As you see above, I am trying to use pseudo-selector function: input[name='checkedID[]']:checked but failed to return the value. Or there is something I missed for the code?

And here is the textbox for return the value checked on the modal-box:

<input type='text' id='products_id_textbox' name='products_id_textbox' />
<a href='#' onclick='showProductsModalBox(); return false;'>Choose products</a>

The code able is to show the modal-box. But how to return the “Product” chosen from each textbox by the user to the textbox products_id_textbox? Thanks.

  • 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-13T07:17:31+00:00Added an answer on June 13, 2026 at 7:17 am

    The problem solved with this code:

    <script>
    $("input#checkedID").change(function () {
      var str = "";
      $("input:[name='checkedID[]']:checked").each(function () {
            str += $(this).val() + ", ";
      });
      $("input#products_id_textbox").val(str);
    })
    .trigger('change');
    </script>
    

    and a modification on the button that just for closing the modal-box:

    <a href=\"javascript:;\" onclick=\"$('#products_modal_box').dialog('close')();\">Submit</a>
    

    That function called :checked Selector.

    Thank you very much and hope helps… 🙂

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

Sidebar

Related Questions

I just want to have php determines whether a checkbox is checked, but I
Consider a simple each loop to inspect checked checkboxes: $(':checkbox').filter(':checked').each(function(){ var name = $(this).val();
Sometimes I want to return the value that is a property of an object
Suppose we want to return a value from a function based on a condition.
I have a method. I want to return a value not from the main
Possible Duplicate: Return value from thread I want to get the free memory of
I want to negate the return value of a function in a cool way.
I want to access java script's return value , which in is in a
I want to assign a NiceMock with the return value of a method. The
I want to pass HTMLPage as a return value of my WCF REST Service

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.