I am creating div inside div tag on button click, It is created and shown on UI , but
I am unable to get the unique value inserted in dynamic created div. I always get
the first value.
Code sample:
<div id="row-list-outer"> </div>
Dynamically adding code sample, This code runs on each click
$("#row-list-outer").append(` <div class="row g-3">
<div>
<input type="text" id="salesPersonName" placeholder="Name">
</div>
</div>)
Now input element is created on click, but If I enter a value in 2nd row input, or 3rd row input etc. Then How I get those values in the same order as they are inserted. For example if the user enters in first row input, then it should be stored on index 0 in array, similarly, if user enters in 1 row, 2nd row, then it should be inserted on array at index 1, 2 respectively
2
Answers
You can try something like this:
Demo
You can try the following code:
HTML:
Jquery: