Jump to content
Sign in to follow this  
neilfurry

Sum of Arrays within Arrays using jquery and javascript

Recommended Posts

Hello,

 

Im hoping to get help from here,

 

i have arrays of text fields that i need to get sums,..

 

<div class='fldgroup'>

<input type="text" name="fld[0]">

<input type="text" name="fld[0]">

<input type="text" name="fld[0]">

<input type="text" name="sumfld[0]">

<button>Add Another Field</button>

 

 

<input type="text" name="fld[1]">

<input type="text" name="fld[1]">

<input type="text" name="fld[1]">

<input type="text" name="sumfld[1]">

<button>Add Another Field</button>

</div>

 

<button>Add Another Group</button>

 

 

how can i get the sum of all fld[0] and put it to sumfld[0] same as the fld[1] to sumfld[1],.. every text field is dynamically added using clone.,

 

i hope somebody can help me with this....

 

Thank you in advance...

Share this post


Link to post
Share on other sites

im wrong with the group structure. here is the correct grouping of array.

 

<div class='fldgroup'>

<input type="text" name="fld[0]">

<input type="text" name="fld[0]">

<input type="text" name="fld[0]">

<input type="text" name="sumfld[0]">

<button>Add Another Field</button>

</div>

 

<div class='fldgroup'>

<input type="text" name="fld[1]">

<input type="text" name="fld[1]">

<input type="text" name="fld[1]">

<input type="text" name="sumfld[1]">

<button>Add Another Field</button>

</div>

 

<button>Add Another  Field Group</button>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.