I'm trying to make a kind of interactive page. Basically, I'm using jQuery Repeater and code looks like below code.
HTML
<form class="repeater">
<div data-repeater-list="group-a">
<div data-repeater-item>
<input type="text" name="text-input" value="A"/>
<input data-repeater-delete type="button" value="Delete"/>
</div>
<div data-repeater-item>
<input type="text" name="text-input" value="B"/>
<input data-repeater-delete type="button" value="Delete"/>
</div>
</div>
<input data-repeater-create type="button" value="Add"/>
</form>
This code is just an example in official Repeater website. As you can see, every input has a name attribute and it would be sort like group-a[0][text-input]
if you initialize Repeater function. So, the one thing that I want to do is to handle this group-a[0][text-input]
selector event.
The only code that I can come up with is:
$("input[name='group-a[][text-input]']").change(function () {
// Kind of things.
});
But I'm not sure it is possible. If it is possible, I will make item order line. For example, if I add new item in this list, I can change price or quantity of this item and total amount would be calculated. If it is not, please tell me API or function library. I have a little bit of mind that I have to use React or Vue.js for making those things.