Whenever I click on the ADD button, I am dynamically adding three textboxes. These textboxes are located within the same div tag and each has a different name.
Therefore, every time I click on the ADD button, I create a new div with three textboxes inside it.
Now, I need to be able to access the values entered into these text fields. How can I do that?
<div class="ord" id="parent">
</div>
<button type="button" class="btn btn-primary fa fa-plus add btn-xs"> Add </button>
JS
var items = "<form role='form' class='form-inline' style='padding-bottom: 5px;'>"
+ "<div class='form-group'><input id='med' placeholder='' class='form-control'></div>"
+ "<div class='form-group' style='padding-left: 5px;'><input id='qua' placeholder='' class='form-control'></div>"
+ "<div class='form-group' style='padding-left: 5px;'><input id='rem' placeholder='' class='form-control'></div>"
$('.add').on("click",function(){
div_id = div_id + 1
$( ".ord" ).append('<div id="item'+div_id+'">' + items + '<button style="margin-left: 3px;" type="button" id="item'+div_id+'" class="btn btn-default btn-danger btn-xs fa fa-close" onclick=deleteitem(id)></button></form></div>');
})
I have an array of IDs for all the div tags, such as [item1, item2, item3].
How can I retrieve the text entered in all the text fields?