简体   繁体   中英

Dynamic Text under Product Price on Product page in case a variation is selected

How can I create a text A under the product price on the product page in case a variation is not selected. When a variation is selected I would like to have another text B. To be exact: Text A: incl. VAT free premium shipping Text B: incl. VAT + free premium shipping(in black color and bold).

The text should go under the price.

Thank you very much.

You can do that with javascript exemple:

 function AddTVA(){ var checkBox = document.getElementById("myCheck"); var text = document.getElementById("text"); if (checkBox.checked == true){ document.getElementById("price").innerHTML = "12.00"; } else { document.getElementById("price").innerHTML = "10.00"; } }
 <div> <h2>Product name</h2> <p><span id="price">10.00</span>$</p> <input type="checkbox" id="myCheck" onclick="AddTVA()"/> <label for="myCheck">Add TVA</label> </div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM