javascript - How do I dynamically add and name an HTML Select list withJquery -
i trying build form dynamically adds elements based upon parent select lists.
<select name="itemlist[]" class="itemlist" > <option value="0" disabled="disabled" selected="selected">select</option> <option value="1">1 item</option> <option value="2">2 item</option> <option value="3">3 item</option> <option value="4">4 item</option> <option value="5">5 item</option> <option value="6">6 item</option> </select>
when option selected jquery event dynamically add 1-x textboxes based on select list value. possible name textboxes parent.child follow selectlist name textbox[] e.g. (index select list value selected , fetched using jquery function)
$("#mydiv").append('<div>items:<input type="text" class="textboxitems" name="itemlist[' + index + '].textbox[]" /></div><br>');
does seem correct? possible name parent/child arrays in way? if yes both should able retrieve input itemlist[0].textbox[0]
, forth?
many pointers.
Comments
Post a Comment