I currently have two dynamic containers with one displaying grouped boxes, quantities, and totals, while the other shows detailed information.
Both container values are added dynamically at runtime. By default, the grouping container is displayed on the page.
The values are fetched using jQuery to showcase them in a "preview" table located outside the div containers.
I am attempting to utilize slidetoggle functionality to switch between the containers upon clicking a link, which works smoothly. However, I am encountering issues with the table as the values appear incorrect initially and upon subsequent clicks of the link.
For reference, you can view my current jQuery script here: [My jsfiddle][1]
Below is the test markup:
<div class="ToogleGroupContainer">
<div class="shipToSingleSection">
<div class="shoppingCart_Category">
<div class="shoppingCart_Box">Box#01</div>
<div class="shoppingCart_qtyArea">
<div class="shoppingCart_qtyLabel">QTY</div>
<div class="shoppingCart_qty-select">5</div>
</div>
<div class="shoppingCart_Price_Each">Each 26.99</div>
<div class="shoppingCart_SubTotal_Each">Price 134.95</div>
</div>
<hr />
</div>
<div class="shipToMultipleSection" style="display:none;">
<div class="shoppingCart_Category">
<div class="shoppingCart_Box">Box#01</div>
<div class="shoppingCart_qtyArea">
<div class="shoppingCart_qtyLabel">QTY</div>
<div class="shoppingCart_qty-select">1</div>
<div class="shoppingCart_qty-select">1</div>
<div class="shoppingCart_qty-select">1</div>
<div class="shoppingCart_qty-select">1</div>
<div class="shoppingCart_qty-select">1</div>
</div>
<div class="shoppingCart_Price_Each">Each 26.99</div>
<div class="shoppingCart_SubTotal_Each">Price 26.99</div>
</div>
<hr />
</div>
</div>
<table class="tableOrderPreviewTotals" border=1>
<tr>
<td class="yord_hdr">Item</td>
<td class="yord_hdr_center">QTY</td>
<td class="yord_hdr_center">Each</td>
<td class="yord_hdr_center">Price</td>
</tr>
<tr>
<td class="yord_line_item" stlye="display:none;">
<div id="itemOrderPreview"></div></td>
<td class="yord_line_qty" stlye="display:none;">
<div id="qtyOrderPreview"></div></td>
<td class="yord_line_right" stlye="display:none;">
<div id="priceEachOrderPreview"></div>
</td>
<td class="yord_line_right" stlye="display:none;">
<div id="subtotalEachOrderPreview"></div>
</td>
</tr>
</table>
<br/>
<a href="" class="shipToMultipleLink">Ship Order to Multiple Addresses</a>
It's apparent that there are inconsistencies in the data presentation. The goal is to show values accurately based on which container is active on the page.
The desired default display should be:
Item QTY Each Price
Box#1 5 26.99 134.95
Once the "Ship to multiple addresses" link is clicked (toggled), the table lines should adjust accordingly:
Item QTY Each Price
Box#1 1 26.99 26.99
Box#1 1 26.99 26.99
Box#1 1 26.99 26.99
Box#1 1 26.99 26.99
Box#1 1 26.99 26.99
Upon toggling back to the "Ship to single address" mode, the table line should revert to the default display:
Item QTY Each Price
Box#1 5 26.99 134.95
Any assistance provided will be highly appreciated!
Thank you for your help.