What I want to do is return the value set for each checkbox in the modal field to the text box. This question is very similar to this one , but the purpose of the question is different. So please take a look at both of them. :)
I have code to initialize a modal window:
<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> </th> <th>Product</th> </tr> </thead> <tbody> <?php </tbody> </table> </form> </div> </div> </div>
As you see above, I am trying to use a pseudo selector : input[name='checkedID[]']:checked , but could not return the value. Or something I missed for the code?
And here is the text field to return the value specified in the modal field:
<input type='text' id='products_id_textbox' name='products_id_textbox' /> <a href='#' onclick='showProductsModalBox(); return false;'>Choose products</a>
Code capable of showing a modal box. But how to return the "Product" selected from each text field by the user to the products_id_textbox text field? Thanks.
source share