slj90 Posted June 13, 2015 Share Posted June 13, 2015 I have a form which allows users to add textboxes but I am struggling figuring out what the name of the new textbox's are? $(document).ready(function() { var max_fields = 10; //maximum input boxes allowed var wrapper = $(".input_fields_wrap"); //Fields wrapper var add_button = $(".add_field_button"); //Add button ID var x = 1; //initlal text box count $(add_button).click(function(e){ //on add input button click e.preventDefault(); if(x < max_fields){ //max input box allowed x++; //text box increment $(wrapper).append('<div><input type="text" onclick=" class="form-control" name="list[]"/><a href="#" class="remove_field">Remove</a><br></div>'); //add input box } }); $(wrapper).on("click",".remove_field", function(e){ //user click on remove text e.preventDefault(); $(this).parent('div').remove(); x--; }) }); </script> Quote Link to comment https://forums.phpfreaks.com/topic/296793-generating-textboxs-need-help-getting-name/ Share on other sites More sharing options...
requinix Posted June 13, 2015 Share Posted June 13, 2015 The name is "list[]". Am I missing something? Quote Link to comment https://forums.phpfreaks.com/topic/296793-generating-textboxs-need-help-getting-name/#findComment-1513817 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.