This is going to be a bit long / complex, sorry about this.

I'm programming an ACBC. In the BYO, I would like to add a custom total price row below the actual total price to show a "price after discount" (which is total price / sum of costs multiplied by a numerical value).

Total price, as calculated by summed pricing is ACBC_BYO_13.

The attribute that will define the discount factor is ACBC_BYO_5.

Because the discount factor is conditional on 2 attributes, I am using the Conditional Display to show some text including a span that contains the value (<span id="discount">) so I can go and grab it.

What is not working: after I make a choice in attribute 5, which defines the discount factor, the Conditional Display works and I see the #discount span. But the value grabbed from #discount returns 0 in the console log. And of course the discounted price shows as 0 as well.

Only after making a choice in *another* attribute does the console log show me the correct discount factor (variable discount), and calculations then work / the discounted price is correct.

So what I would need is to grab the value of #discount right after a selection is made on ACBC_BYO_5.

Any idea?

<script type="text/javascript"> $(document).on("ssi_ready", function(){ // adding a 2nd tr below Total price for Discounted price -at first hidden $('tr.acbc_task_bottom_row').after('<tr class="acbc_task_bottom_row bottom2"><td class="inner_table_cell"> </td><td class="total_label_cell inner_table_cell">Discounted monthly price</td><td class="price_cell total_price inner_table_cell"><table cellpadding="0" cellspacing="0"><tbody><tr><td>$</td><td><input name="ACBC_BYO_14" type="tel" id="ACBC_BYO_14" class="acbc_byo_price_box numeric_input" disabled="" tabindex="597"></td></tr></tbody></table></td></tr>') $('tr.bottom2').hide(); $('select').change(function(){ // grabbing the current total price var price = parseInt($('#ACBC_BYO_13').val().replace(',','')); // grabbing the current discount value -in a conditional display below the byo var discount = parseFloat($('#discount').html()); // calculating the discounted price var discounted = $.number(price * discount,0,".",","); // if the discount multiplier is not 1 (which means, no discount) and if a choice has been made in attribute 5, show the discounted price row if(discount!=1 && $('[name="ACBC_BYO_5"]').val()!=""){$('tr.bottom2').show();} // assigning the discounted price to the numerical cell of the additional tr added earlier in the script $('#ACBC_BYO_14').val(discounted); }) }); </script>