Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamically adding a table row with jquery, then add auto populate select box in each new row
    primarykey
    data
    text
    <p>Hey, guys, I tried to ask this yesterday but I didn't explain myself clearly or simply enough.</p> <p>I have a form that is setup in a table. User can add new rows (and more form elements) as they please. Each row of this form needs to have its own separate select box and corresponding subcategory select box.</p> <p>So basically...</p> <p>Name | Select<BR> xxxxxx | [category select] [subcategory select]<BR> xxxxxx | [category select] [subcategory select]<BR> xxxxxx | [category select] [subcategory select]<BR></p> <p>You get the idea. :)</p> <p>Right now any rows added have a broken version of the auto populate.</p> <p>Any suggestions as to how to get this to work?</p> <p>Here is the auto populate code and add table row code I'm using, if this helps racks anyone's brain. I'll gladly scrap everything if someone has an answer they feel is better.</p> <p>Free cookie for a solution where I can add/remove form rows. :)</p> <pre><code>// auto populate select code $(document).ready(function(){ $("#selectionresult").hide(); $("#selection").change( function() { $("#selectionresult").hide(); $("#result").html("Retrieving ..."); $.ajax({ type: "POST", data: "data=" + $(this).val(), url: "include/javascript_population.php", success: function(msg){ if (msg != ""){ $("#selectionresult").html(msg).show(); $("#result").html(""); } else{ $("#result").html("&lt;em&gt;No item result&lt;/em&gt;"); } } }); }); }); // add table row code $(document).ready(function() { $("#add").click(function() { $('#mytable tbody&gt;tr:last').clone(true).insertAfter('#mytable tbody&gt;tr:last'); return false; }); }); $("#mytable tbody&gt;tr:last").each(function() {this.reset();}); </code></pre> <p>Any help would be totally appreciated everybody. Thanks in advance. :) </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload