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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -