I have a table of textboxes which is dynamically create (based off the number of users and levels in my db).
I want the sum of each row to be 100 - the easiest way to ensure this is to update the row sum after any change in the textboxes.
The kicker is that I need to keep the user/level associations so that I can upload the new numbers to the database. Was thinking of using name=“L5-U1” (level 5 - user 1) as the name attributes for each of the textboxes but unsure of how to sum the boxes using this method.
I’m not amazing at js and know I need to use loops, but what would be the best way to go about this?
After some further research, I think the best way is to assign the same class per row and add up all the textboxes in that class. What code would I use to auto-select the affiliated class? (e.g. I can’t have a specific class listed in the function since they are dynamically generated, need to use “this” or pass the class name via onkeyup)