Update "total payment" in real time with javascript

Hello everyone,

Do you think there’s a way update the total balance in real time using javascript? I would select the “unpaid invoices” in a table, and based on what is selected, the balances combine together so one full payment is applied toward many invoices.

Sample video here:

Thanks anyone for your help.
@Chem , @moe

Although my JavaScript skills are weak, I’m certain this can be done.

See here for something similar - Run basic math in real time on a form using JavaScript