Skip to main content
Struck through incorrect portion of answer
Source Link
Malachy
  • 596
  • 4
  • 9

I think you should approach this by listening to an onChange DOM event on the <div class="price-box"> DOM node, then extract the price innerHTML and update the innerHTML of the second place you want the price to show.I think you should approach this by listening to an onChange DOM event on the <div class="price-box"> DOM node, then extract the price innerHTML and update the innerHTML of the second place you want the price to show.

Plan B would be to analyse, modify or duplicate parts of the JavaScript function OptionsPrice.reload() which is in the object Product.OptionsPrice.prototype = {

You can't just repeat the HTML because (I expect) that Prototype.js is coded to match only the first DOM node via a CSS selector rather than tracking an array of nodes that match the price selector. If you are going for Plan B then changing the code to select (and update) an array of price box DOM nodes instead of only the first matched node would be an elegant solution.

Remember that the id attribute of DOM nodes needs to be unique.

I think you should approach this by listening to an onChange DOM event on the <div class="price-box"> DOM node, then extract the price innerHTML and update the innerHTML of the second place you want the price to show.

Plan B would be to analyse, modify or duplicate parts of the JavaScript function OptionsPrice.reload() which is in the object Product.OptionsPrice.prototype = {

You can't just repeat the HTML because (I expect) that Prototype.js is coded to match only the first DOM node via a CSS selector rather than tracking an array of nodes that match the price selector. If you are going for Plan B then changing the code to select (and update) an array of price box DOM nodes instead of only the first matched node would be an elegant solution.

Remember that the id attribute of DOM nodes needs to be unique.

I think you should approach this by listening to an onChange DOM event on the <div class="price-box"> DOM node, then extract the price innerHTML and update the innerHTML of the second place you want the price to show.

Plan B would be to analyse, modify or duplicate parts of the JavaScript function OptionsPrice.reload() which is in the object Product.OptionsPrice.prototype = {

You can't just repeat the HTML because (I expect) that Prototype.js is coded to match only the first DOM node via a CSS selector rather than tracking an array of nodes that match the price selector. If you are going for Plan B then changing the code to select (and update) an array of price box DOM nodes instead of only the first matched node would be an elegant solution.

Remember that the id attribute of DOM nodes needs to be unique.

Source Link
Malachy
  • 596
  • 4
  • 9

I think you should approach this by listening to an onChange DOM event on the <div class="price-box"> DOM node, then extract the price innerHTML and update the innerHTML of the second place you want the price to show.

Plan B would be to analyse, modify or duplicate parts of the JavaScript function OptionsPrice.reload() which is in the object Product.OptionsPrice.prototype = {

You can't just repeat the HTML because (I expect) that Prototype.js is coded to match only the first DOM node via a CSS selector rather than tracking an array of nodes that match the price selector. If you are going for Plan B then changing the code to select (and update) an array of price box DOM nodes instead of only the first matched node would be an elegant solution.

Remember that the id attribute of DOM nodes needs to be unique.