In this thread http://www.chronoengine.com/forums/posts/f5/t99923/how-to-set-end-count-in-multiplier-container.html?hilit=multiplier+button (locked) Bob answered with an example of js code.
Note that this allows for the fact that some lines may be deleted and new ones added.
The example that you linked to handles that case - if a multiplier is deleted then the Add button will show again. Basically it counts the multipliers and if the count is less than the limit shows the Add button, if it's at the limit it hides the Add button.
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
Sorry Bob but it can't work.
Your calculate() function runs only when the you click on the add button, as per code you wrote in that post.
If you want to run calculate() when you remove a multiplier content there must be an event handler for the .multiplier-remove-button elements.
I solved the problem by adding the following line to jQuery(document).ready():
jQuery('.multiplier-container').on('click', '.multiplier-remove-button', calculate);
Apologies, you are quite right. I went back and found the 'final' version of that code which did do both:
. . .
jQ('#garment_multiplier').on('click', '.multiplier-remove-button', delayUpdate );
jQ('#garment_multiplier').on('change', '.update', calculateGarmentPrice );
This function delays the execution of the calculate function
to allow time for the multiplier code to add the new item.
var i, quantity, max_quantity, g_id, diff, new_g_id_list;
max_quantity = 100;
/** There is a hidden input with the class g_id
that has the item number set as its value.
We find all the current values here */
g_id = jQ('#garment_multiplier :input').filter('.g_id');
new_g_id_list = g_id.map(
. . .
2CheckOut.com Inc. (Ohio, USA) is an authorized retailer for goods and services provided by ChronoEngine.com