Skip to content
Advertisement

Multiplying inputs with dynamic add

I have 3 fields with inputs:

JavaScript

Multiply rate_basic by qty_basic with js:

JavaScript

It works fine, but I have a button that add a row with the same inputs and the same id, but the calculation only works with the first row. How to make it work with all inputs? thanks

Add function to row:

JavaScript

Advertisement

Answer

You should add dynamic id

JavaScript

Now when you create New Row

JavaScript
JavaScript

https://codepen.io/flakerimi/pen/xxgVpWR I have simplified a bit but you get the idea.

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement