Skip to content
Advertisement

Add quantities from an input created with While in PHP to a DIV

i have a little problem when try do this operation:

enter image description here

This its the crazy code to try do.

JavaScript

INPUT TO DO :

JavaScript

DIV TO SHOW

JavaScript

ALL CRAZY CODE

JavaScript

Thanks for the time and help.

Advertisement

Answer

Work to separate PHP from the clientside code, you can initialize the values from PHP onto the DOM by setting the values of the inputs (you can also calculate the result of the initial values in PHP and place in your result column).

Then pass control over to js/jquery to do the rest like traversing the DOM by selecting the rows then running over the inputs to update the values on change.

Like the following, sorry not going to rewrite your code, its just too much of a mess.

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